Lines 61-66
Link Here
|
61 |
import org.apache.xmlbeans.XmlException; |
61 |
import org.apache.xmlbeans.XmlException; |
62 |
import org.apache.xmlbeans.XmlObject; |
62 |
import org.apache.xmlbeans.XmlObject; |
63 |
import org.apache.xmlbeans.XmlOptions; |
63 |
import org.apache.xmlbeans.XmlOptions; |
|
|
64 |
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTAbsoluteAnchor; |
65 |
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing; |
66 |
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTOneCellAnchor; |
67 |
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTTwoCellAnchor; |
64 |
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId; |
68 |
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId; |
65 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookView; |
69 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookView; |
66 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookViews; |
70 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookViews; |
Lines 383-392
Link Here
|
383 |
throw new POIXMLException("Failed to clone sheet", e); |
387 |
throw new POIXMLException("Failed to clone sheet", e); |
384 |
} |
388 |
} |
385 |
CTWorksheet ct = clonedSheet.getCTWorksheet(); |
389 |
CTWorksheet ct = clonedSheet.getCTWorksheet(); |
386 |
if(ct.isSetDrawing()) { |
390 |
if(ct.isSetPageSetup()) |
387 |
logger.log(POILogger.WARN, "Cloning sheets with drawings is not yet supported."); |
391 |
{ |
388 |
ct.unsetDrawing(); |
392 |
logger.log(POILogger.WARN, "Cloning sheets with page setup is not yet supported."); |
389 |
} |
393 |
ct.unsetPageSetup(); |
|
|
394 |
} |
395 |
if (ct.isSetDrawing()) |
396 |
{ |
397 |
ct.unsetDrawing(); |
398 |
|
399 |
CTDrawing srcDrawing = srcSheet.createDrawingPatriarch().getCTDrawing(); |
400 |
|
401 |
// Clone drawing relations |
402 |
List<POIXMLDocumentPart> srcRels = srcSheet.createDrawingPatriarch().getRelations(); |
403 |
for (POIXMLDocumentPart rel : srcRels) |
404 |
{ |
405 |
PackageRelationship relation = rel.getPackageRelationship(); |
406 |
clonedSheet |
407 |
.createDrawingPatriarch() |
408 |
.getPackagePart() |
409 |
.addRelationship(relation.getTargetURI(), relation.getTargetMode(), |
410 |
relation.getRelationshipType(), relation.getId()); |
411 |
} |
412 |
|
413 |
// Clone drawing content |
414 |
CTDrawing clonedDrawing = clonedSheet.createDrawingPatriarch().getCTDrawing(); |
415 |
for (CTTwoCellAnchor anchor : srcDrawing.getTwoCellAnchorList()) |
416 |
{ |
417 |
clonedDrawing.getTwoCellAnchorList().add(anchor); |
418 |
} |
419 |
for (CTOneCellAnchor anchor : srcDrawing.getOneCellAnchorList()) |
420 |
{ |
421 |
clonedDrawing.getOneCellAnchorList().add(anchor); |
422 |
} |
423 |
for (CTAbsoluteAnchor anchor : srcDrawing.getAbsoluteAnchorList()) |
424 |
{ |
425 |
clonedDrawing.getAbsoluteAnchorList().add(anchor); |
426 |
} |
427 |
} |
390 |
if(ct.isSetLegacyDrawing()) { |
428 |
if(ct.isSetLegacyDrawing()) { |
391 |
logger.log(POILogger.WARN, "Cloning sheets with comments is not yet supported."); |
429 |
logger.log(POILogger.WARN, "Cloning sheets with comments is not yet supported."); |
392 |
ct.unsetLegacyDrawing(); |
430 |
ct.unsetLegacyDrawing(); |