[]
DsExcel Java provides extensive support for loading, saving, printing and exporting Excel files comprising shapes and other drawing objects embedded in the worksheets.
The getIsPrintable and the setIsPrintable methods of the IShape interface can be used to get or set whether the object will be printed in the PDF document. By default, this value is TRUE and hence the shapes embedded in the Excel files are printed. In case you do not want to export shapes to the PDF files, this value must be set to FALSE.
The Export Shapes to PDF feature allows users to print and export different types of shapes such as callouts, lines, rectangles, basic shapes, block arrows, flowcharts, equation shapes, stars and banners etc. This feature is useful especially when the following scenarios are encountered while working with spreadsheets:
When users have Excel files with graphs, reports and dashboards containing various shapes that they want to export to a PDF file.
With the help of this feature, users can export spreadsheets that contain preset shapes, basic shapes, custom shapes and grouped shapes with different operations like rotation, flipping, connector arrows and text etc. into a PDF file.
When users need to export Excel template files and spreadsheets containing shapes with different types of fills (like Solid fill, Gradient fill etc.) while saving to a PDF file.
Refer to the following example code in order to export shapes to PDF.
// Initialize workbook
Workbook workbook = new Workbook();
// Fetch default worksheet
IWorksheet worksheet = workbook.getWorksheets().get(0);
// Adding Shapes
IShape ShapeBegin =
worksheet.getShapes().addShape(AutoShapeType.CloudCallout, 1, 1, 100, 100);
IShape EndBegin =
worksheet.getShapes().addShape(AutoShapeType.Wave, 200, 200, 100, 100);
// Adding Connector Shape
IShape ConnectorShape = worksheet.getShapes()
.addConnector(ConnectorType.Straight, 1, 1, 101, 101);
// Connect shapes by connector shape
ConnectorShape.getConnectorFormat().beginConnect(ShapeBegin, 3);
ConnectorShape.getConnectorFormat().endConnect(EndBegin, 0);
/* Get second shape in current worksheet( here it's a connector shape)
and do not print it(default value is true) */
worksheet.getShapes().get(2).setIsPrintable(false);
// Saving workbook to PDF
workbook.save("ExportShapesToPDF.pdf", SaveFileFormat.Pdf);Note: While exporting Excel files containing shapes into the PDF format, some of the exported shapes including the shapes with gradient fill and pattern fill; shapes with multiple lines and gradient lines; shape effects, text settings like text justify, text distribution and vertical text may not work exactly the same as in Excel.
DsExcel Java supports preserving bullet formatting in shape text when exporting to PDF. The exported PDF file will correctly display bullet types, colors, sizes, and other properties, ensuring the visual appearance matches Excel as closely as possible.
When exporting an Excel file containing shapes with bulleted text, DsExcel Java automatically parses and renders the bullet definitions from the source file.
DsExcel Java supports exporting the following three types of bullets:
Bullet Type | Description |
|---|---|
Symbol bullet | Uses special symbols (•, ○, ■, etc.) as bullet markers |
Automatic numbering bullet | Uses numeric or alphabetic sequences (1, 2, 3 or a, b, c, etc.) |
Customize bullet | User-defined custom symbols |
When exporting to PDF, DsExcel Java preserves the following bullet properties:
Color: The bullet color is determined by the following priority:
Bullet's own color (if set)
Paragraph text color (fallback if bullet color is not set)
Size: The bullet size is proportional to the paragraph font size. This proportion can be configured in Excel's bullet settings and will be preserved during export.
Styles: The following styles are supported for bullets:
Strikethrough: Applies to all bullet types (symbol, automatic numbering, and customize bullets)
Bold/Italic: Only applies to automatic numbering bullets
The following example demonstrates how to export an Excel file containing shapes with bullets to PDF. The bullet formatting is automatically preserved during export.
// Create a new workbook.
Workbook workbook = new Workbook();
// Open an Excel file that contains shapes with bullets.
workbook.open("Bullet.xlsx");
// Export to PDF.
workbook.save("BulletToPDF.pdf");The output is shown in the figure below:

Limitations
Image-based bullets are not currently supported. If an Excel file uses images as bullet markers, those bullets will not be displayed in the exported PDF.