List of usage examples for org.apache.poi.xssf.usermodel XSSFDrawing getCTDrawing
@Internal
public CTDrawing getCTDrawing()
From source file:net.mcnewfamily.rmcnew.shared.Util.java
License:Open Source License
public static void copySheetDrawings(XSSFSheet srcSheet, XSSFSheet destSheet) { if (srcSheet != null && destSheet != null) { XSSFDrawing srcDrawing = srcSheet.createDrawingPatriarch(); XSSFDrawing destDrawing = destSheet.createDrawingPatriarch(); org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing srcCTDrawing = srcDrawing .getCTDrawing();//from w w w . j a va 2 s .co m org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing destCTDrawing = destDrawing .getCTDrawing(); destCTDrawing.set(srcCTDrawing.copy()); } else { throw new IllegalArgumentException("Cannot copy drawings from / to null XSSFSheet!"); } }
From source file:org.tiefaces.components.websheet.utility.ChartUtility.java
License:MIT License
/** * Inits the XSSF anchors map for sheet. * * @param anchortMap/*from w w w .j a v a2 s. c o m*/ * the anchort map * @param positionMap * the position map * @param sheet * the sheet */ private static void initXSSFAnchorsMapForSheet(final Map<String, ClientAnchor> anchortMap, final Map<String, String> positionMap, final XSSFSheet sheet) { XSSFDrawing drawing = sheet.createDrawingPatriarch(); CTDrawing ctDrawing = drawing.getCTDrawing(); if (ctDrawing.sizeOfTwoCellAnchorArray() <= 0) { return; } List<CTTwoCellAnchor> alist = ctDrawing.getTwoCellAnchorList(); for (int j = 0; j < alist.size(); j++) { CTTwoCellAnchor ctanchor = alist.get(j); String singleChartId = getAnchorAssociateChartId(ctanchor); if (singleChartId != null) { String chartId = sheet.getSheetName() + "!" + singleChartId; int dx1 = (int) ctanchor.getFrom().getColOff(); int dy1 = (int) ctanchor.getFrom().getRowOff(); int dx2 = (int) ctanchor.getTo().getColOff(); int dy2 = (int) ctanchor.getTo().getRowOff(); int col1 = ctanchor.getFrom().getCol(); int row1 = ctanchor.getFrom().getRow(); int col2 = ctanchor.getTo().getCol(); int row2 = ctanchor.getTo().getRow(); anchortMap.put(chartId, new XSSFClientAnchor(dx1, dy1, dx2, dy2, col1, row1, col2, row2)); positionMap.put(WebSheetUtility.getFullCellRefName(sheet.getSheetName(), row1, col1), chartId); } } }