[] 
(Showing Draft Content)

Export Vertical Text

DsExcel Java allows users to export Excel files with vertical text to PDF without any issues. While saving an Excel file with vertical text correctly to a PDF file, the following properties can be used -

  • IRange.Orientation - The setOrientation() method of the IRange interface sets the orientation of the text.
  • IRange.Font.Name - Sets the specific font name using the getFont method of the IRange interface. If the font name starts with "@", each double-byte character in the text is rotated to 90 degrees.

Refer to the following example code in order to export vertical text to PDF.

// Initialize workbook Workbook workbook = new Workbook(); // Fetch default worksheet IWorksheet worksheet = workbook.getWorksheets().get(0); // Fetch the cell range A1 IRange a1 = worksheet.getRange("A1"); // Setting Cell A1 Text a1.setValue("This is a vertical text"); // Formatting A1 cell a1.getFont().setName("Verdana"); a1.setHorizontalAlignment(HorizontalAlignment.Right); a1.setVerticalAlignment(VerticalAlignment.Top); a1.setOrientation(90); a1.setWrapText(true); a1.setColumnWidth(27); a1.setRowHeight(190); // Saving workbook to PDF workbook.save("6- ExportVerticalTextToPDF.pdf", SaveFileFormat.Pdf); 

type=note

Note: The following limitations must be kept in mind while exporting Excel files with vertical text to PDF -

  • The orientation can only be set to 0, 90, -90 and 255. Other values will be treated as 0 while rendering the PDF file.
  • If the font name starts with "@" and the orientation is 255, DsExcel will ignore the "@".