Examples of Drawing


Examples of org.apache.poi.ss.usermodel.Drawing

       // Sheet 1 doesn't (yet)
       assertNull(sh1.getCommentsTable(false));
      
       // Try to add comments to Sheet 1
       CreationHelper factory = wb.getCreationHelper();
       Drawing drawing = sh1.createDrawingPatriarch();

       ClientAnchor anchor = factory.createClientAnchor();
       anchor.setCol1(0);
       anchor.setCol2(4);
       anchor.setRow1(0);
       anchor.setRow2(1);

       Comment comment1 = drawing.createCellComment(anchor);
       comment1.setString(
             factory.createRichTextString("I like this cell. It's my favourite."));
       comment1.setAuthor("Bob T. Fish");
      
       Comment comment2 = drawing.createCellComment(anchor);
       comment2.setString(
             factory.createRichTextString("This is much less fun..."));
       comment2.setAuthor("Bob T. Fish");

       Cell c1 = sh1.getRow(0).createCell(4);
View Full Code Here

Examples of org.docx4j.openpackaging.parts.DrawingML.Drawing

   
    SpreadsheetMLPackage pkg = SpreadsheetMLPackage.createPackage();
    WorksheetPart worksheet = pkg.createWorksheetPart(new PartName("/xl/worksheets/sheet1.xml"), "Sheet1", 1);

    // Create Drawing part and add to sheet
    Drawing drawingPart = new Drawing();
    Relationship drawingRel = worksheet.addTargetPart(drawingPart);

    // Add anchor XML to worksheet
    org.xlsx4j.sml.CTDrawing drawing = org.xlsx4j.jaxb.Context.getsmlObjectFactory().createCTDrawing();
        worksheet.getJaxbElement().setDrawing(drawing);
            drawing.setId( drawingRel.getId() );    
   
    // Create image part and add to Drawing part
        BinaryPartAbstractImage imagePart
          = BinaryPartAbstractImage.createImagePart(pkg, drawingPart,
              FileUtils.readFileToByteArray(new File(imagefilePath) ));
        String imageRelID = imagePart.getSourceRelationship().getId();
   
    // Create and set drawing part content
        // Take your pick ..
        // .. build it using code
//        drawingPart.setJaxbElement(
//            buildDrawingPartContentUsingCode(imageRelID));
        // .. or build it from an XML string
        drawingPart.setJaxbElement(
            buildDrawingPartContentFromXmlString(imageRelID));
   
   
        // Save the xlsx
    SaveToZipFile saver = new SaveToZipFile(pkg);
View Full Code Here

Examples of org.docx4j.openpackaging.parts.DrawingML.Drawing

        }
    }

    private void putImage(WorksheetPart worksheetPart, SpreadsheetMLPackage pkg, BinaryPartAbstractImage xlsxImage, Image image, CTTwoCellAnchor anchor) throws InvalidFormatException {
        PartName drawingPartName = new PartName(worksheetPart.getPartName().getName().replace("worksheets/sheet", "drawings/drawing"));
        Drawing drawing = (Drawing) pkg.getParts().get(drawingPartName);
        java.util.List<Object> objects = drawing.getJaxbElement().getEGAnchor();
        String rid = "rId" + (objects.size() + 1);

        CTPicture pic = new CTPicture();
        CTPictureNonVisual nvPicPr = new CTPictureNonVisual();
        CTNonVisualDrawingProps nvpr = new CTNonVisualDrawingProps();
        nvpr.setId(objects.size() + 2);
        String name = xlsxImage.getPartName().getName();
        name = name.substring(name.lastIndexOf("/") + 1);
        nvpr.setName(name);
        nvpr.setDescr(name);
        nvPicPr.setCNvPr(nvpr);
        CTPictureLocking ctPictureLocking = new CTPictureLocking();
        ctPictureLocking.setNoChangeAspect(true);
        CTNonVisualPictureProperties nvpp = new CTNonVisualPictureProperties();
        nvpp.setPicLocks(ctPictureLocking);
        nvPicPr.setCNvPicPr(nvpp);
        pic.setNvPicPr(nvPicPr);
        CTBlipFillProperties blipProps = new CTBlipFillProperties();
        CTStretchInfoProperties props = new CTStretchInfoProperties();
        CTRelativeRect rect = new CTRelativeRect();
        props.setFillRect(rect);
        blipProps.setStretch(props);
        CTBlip blip = new CTBlip();
        blip.setEmbed(rid);
        blip.setCstate(STBlipCompression.PRINT);
        blipProps.setBlip(blip);
        pic.setBlipFill(blipProps);
        CTShapeProperties sppr = new CTShapeProperties();
        ImageSize imageSize = new ImageSize(image.width, image.height, 96);//todo this doesn't work unfortunately
        imageSize.calcSizeFromPixels();
        CTPoint2D off = new CTPoint2D();
        off.setX(0);
        off.setY(0);
        CTPositiveSize2D ext = new CTPositiveSize2D();
        ext.setCx(imageSize.getWidthMpt());
        ext.setCy(imageSize.getHeightMpt());
        CTTransform2D xfrm = new CTTransform2D();
        xfrm.setOff(off);
        xfrm.setExt(ext);
        sppr.setXfrm(xfrm);
        CTPresetGeometry2D prstGeom = new CTPresetGeometry2D();
        prstGeom.setPrst(STShapeType.RECT);
        prstGeom.setAvLst(new CTGeomGuideList());
        sppr.setPrstGeom(prstGeom);
        pic.setSpPr(sppr);
        anchor.setPic(pic);
        CTAnchorClientData data = new CTAnchorClientData();
        anchor.setClientData(data);

        drawing.getJaxbElement().getEGAnchor().add(anchor);

        Relationship rel = new Relationship();
        rel.setId(rid);
        rel.setType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image");
        rel.setTarget("../media/" + name);

        drawing.getRelationshipsPart().addRelationship(rel);
        RelationshipsPart relPart = drawing.getRelationshipsPart();
        pkg.getParts().remove(relPart.getPartName());
        pkg.getParts().put(relPart);
        pkg.getParts().remove(drawing.getPartName());
        pkg.getParts().put(drawing);
    }
View Full Code Here

Examples of org.openpnp.model.eagle.xml.Drawing

        InputSource input = new InputSource(new FileInputStream("/Users/jason/Desktop/adafruit.lbr"));
        Source source = new SAXSource(xmlreader, input);

        Eagle eagle = (Eagle) unmarshaller.unmarshal(source);
        Drawing drawing = (Drawing) eagle.getCompatibilityOrDrawing().get(0);
        Library library = (Library) drawing.getLibraryOrSchematicOrBoard().get(0);
        Packages packages = library.getPackages();
        HashSet<Object> stuff = new HashSet<Object>();
       
        System.out.println("<openpnp-packages>");
       
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.Drawing

    if (srcComment != null) {
      if (dstComment == null) {
        final Worksheet dstSheet = (Worksheet)dstCell.getSheet();
        final Workbook dstBook = dstSheet.getWorkbook();
        final CreationHelper dstFactory = dstBook.getCreationHelper();
        final Drawing drawing = dstSheet.createDrawingPatriarch();
        final ClientAnchor anchor = dstFactory.createClientAnchor();
        dstComment = drawing.createCellComment(anchor);
      }
      dstComment.setString(srcComment.getString());
      dstComment.setAuthor(srcComment.getAuthor());
      dstComment.setVisible(srcComment.isVisible());
      dstCell.setCellComment(dstComment);
View Full Code Here

Examples of research.Drawing

          Set set = informationMap.get(id);

          if (set != null) {
            Iterator valueIterator = set.iterator();
            while (valueIterator.hasNext()) {
              Drawing drawing = (Drawing) valueIterator.next();
              store.store(bufferStream, drawing);
              ZipEntry drawingEntry = new ZipEntry(id + "\\"
                  + drawing.getTitle() + ".draw");
              zipOutStream.putNextEntry(drawingEntry);
              bufferStream.writeTo(zipOutStream);
              zipOutStream.closeEntry();

              bufferStream.reset();
View Full Code Here

Examples of research.Drawing

        @Override
        public boolean isEnabled() {
            if (!super.isEnabled()) return false;

            String viewName = (String) this.getValue(ConstantDefinition.VIEW_NAME);
            Drawing drawing = (Drawing) this.getValue(ConstantDefinition.DRAWING);

            if ((viewName == null) && (drawing == null)) return false;

            return true;
        }
View Full Code Here

Examples of research.Drawing

            if (isDoing) return;

            isDoing = true;

            String viewName = (String) this.getValue(ConstantDefinition.VIEW_NAME);
            Drawing drawing = (Drawing) this.getValue(ConstantDefinition.DRAWING);

            SaturnDrawingView view = createDrawingView();

            if (drawing == null) {
                drawing = createDrawing();
                drawing.setTitle(viewName);
            }

            view.setDrawing(drawing);

            DrawingEditor drawingEditor = (DrawingEditor) getValue(ConstantDefinition.DRAWING_EDITOR);
View Full Code Here

Examples of research.Drawing

        public boolean isEnabled() {
            if (!super.isEnabled()) return false;

            String viewName = (String) this.getValue(ConstantDefinition.VIEW_NAME);
            Drawing drawing = (Drawing) this.getValue(ConstantDefinition.DRAWING);

            if ((viewName == null) && (drawing == null)) return false;

            return true;
        }
View Full Code Here

Examples of research.Drawing

            if (isDoing) return;

            isDoing = true;

            String viewName = (String) this.getValue(ConstantDefinition.VIEW_NAME);
            Drawing drawing = (Drawing) this.getValue(ConstantDefinition.DRAWING);

            SaturnDrawingView view = createDrawingView();

            if (drawing == null) {
                drawing = createDrawing();
                drawing.setTitle(viewName);
            }

            view.setDrawing(drawing);

            DrawingEditor drawingEditor = (DrawingEditor) getValue(ConstantDefinition.DRAWING_EDITOR);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.