/** * @return the sheet associated with the drawing */ public XSSFSheet getSheet() { return (XSSFSheet) getParent(); }
/** * @return the sheet which contains the picture shape */ @Override public XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); }
protected XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); }
/** * Add the indexed picture to this drawing relations * * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . */ @SuppressWarnings("resource") protected PackageRelationship addPictureReference(int pictureIndex) { XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); XSSFPictureData pic = new XSSFPictureData(data.getPackagePart()); RelationPart rp = addRelation(null, XSSFRelation.IMAGES, pic); return rp.getRelationship(); }
XSSFWorkbook wb = (XSSFWorkbook) getDrawing().getParent().getParent(); str.setStylesTableReference(wb.getStylesSource());
/** * @return the sheet associated with the drawing */ public XSSFSheet getSheet() { return (XSSFSheet) getParent(); }
/** * @return the sheet which contains the picture shape */ @Override public XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); }
protected XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); }
private float getRowHeightInPixels(int rowIndex){ XSSFSheet sheet = (XSSFSheet)getDrawing().getParent(); XSSFRow row = sheet.getRow(rowIndex); float height = row != null ? row.getHeightInPoints() : sheet.getDefaultRowHeightInPoints(); return height*PIXEL_DPI/POINT_DPI; }
private float getColumnWidthInPixels(int columnIndex){ XSSFSheet sheet = (XSSFSheet)getDrawing().getParent(); CTCol col = sheet.getColumnHelper().getColumn(columnIndex, false); double numChars = col == null || !col.isSetWidth() ? DEFAULT_COLUMN_WIDTH : col.getWidth(); return (float)numChars*XSSFWorkbook.DEFAULT_CHARACTER_WIDTH; }
/** * Add the indexed picture to this drawing relations * * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . */ @SuppressWarnings("resource") protected PackageRelationship addPictureReference(int pictureIndex) { XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); XSSFPictureData pic = new XSSFPictureData(data.getPackagePart()); RelationPart rp = addRelation(null, XSSFRelation.IMAGES, pic); return rp.getRelationship(); }
/** * Add the indexed picture to this drawing relations * * @param pictureIndex the index of the picture in the workbook collection of pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} . */ protected PackageRelationship addPictureReference(int pictureIndex){ XSSFWorkbook wb = (XSSFWorkbook)getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); PackagePartName ppName = data.getPackagePart().getPartName(); PackageRelationship rel = getPackagePart().addRelationship(ppName, TargetMode.INTERNAL, XSSFRelation.IMAGES.getRelation()); addRelation(rel.getId(),new XSSFPictureData(data.getPackagePart(), rel)); return rel; }
/** * Creates a comment. * @param anchor the client anchor describes how this comment is attached * to the sheet. * @return the newly created comment. */ public XSSFComment createCellComment(ClientAnchor anchor) { XSSFClientAnchor ca = (XSSFClientAnchor)anchor; XSSFSheet sheet = (XSSFSheet)getParent(); //create comments and vmlDrawing parts if they don't exist CommentsTable comments = sheet.getCommentsTable(true); XSSFVMLDrawing vml = sheet.getVMLDrawing(true); schemasMicrosoftComVml.CTShape vmlShape = vml.newCommentShape(); if(ca.isSet()){ String position = ca.getCol1() + ", 0, " + ca.getRow1() + ", 0, " + ca.getCol2() + ", 0, " + ca.getRow2() + ", 0"; vmlShape.getClientDataArray(0).setAnchorArray(0, position); } XSSFComment shape = new XSSFComment(comments, comments.newComment(), vmlShape); shape.setColumn(ca.getCol1()); shape.setRow(ca.getRow1()); return shape; }
XSSFWorkbook wb = (XSSFWorkbook) getDrawing().getParent().getParent(); str.setStylesTableReference(wb.getStylesSource());
public void setText(XSSFRichTextString str){ XSSFWorkbook wb = (XSSFWorkbook)getDrawing().getParent().getParent(); str.setStylesTableReference(wb.getStylesSource()); CTTextParagraph p = CTTextParagraph.Factory.newInstance(); if(str.numFormattingRuns() == 0){ CTRegularTextRun r = p.addNewR(); CTTextCharacterProperties rPr = r.addNewRPr(); rPr.setLang("en-US"); rPr.setSz(1100); r.setT(str.getString()); } else { for (int i = 0; i < str.getCTRst().sizeOfRArray(); i++) { CTRElt lt = str.getCTRst().getRArray(i); CTRPrElt ltPr = lt.getRPr(); if(ltPr == null) ltPr = lt.addNewRPr(); CTRegularTextRun r = p.addNewR(); CTTextCharacterProperties rPr = r.addNewRPr(); rPr.setLang("en-US"); applyAttributes(ltPr, rPr); r.setT(lt.getT()); } } ctShape.getTxBody().setPArray(new CTTextParagraph[]{p}); }