[]
        
(Showing Draft Content)

Export Vertical Text

GcExcel .NET 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 Orientation property of the IRange interface sets the orientation of the text.

  • IRange.Font.Name -  Sets the specific font name using the Font property 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.

// Create workbook and a worksheet.
Workbook workbook = new Workbook();
IWorksheet sheet = workbook.Worksheets[0];

// Specify the font name
sheet.Range["A1"].Font.Name = "@Meiryo";

// Set orientation and wrap text
sheet.Range["A1"].Orientation = -90;
sheet.Range["A1"].WrapText = true;

// Set value and configure horizontal and vertical alignment
sheet.Range["A1"].Value = "日本列島で使用されてきた言語である。GrapeCity";
sheet.Range["A1"].HorizontalAlignment = HorizontalAlignment.Right;
sheet.Range["A1"].VerticalAlignment = VerticalAlignment.Top;

// Set column width and row height

sheet.Range["A1"].ColumnWidth = 27;
sheet.Range["A1"].RowHeight = 190;

// Export the worksheet with vertical text ("sheet") to pdf file.
sheet.Save(@"D:\sheet.pdf", SaveFileFormat.Pdf);

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, GcExcel will ignore the "@".