Document Solutions for Excel, .NET Edition | Document Solutions
File Operations / Export to PDF / Export Vertical Text
In This Topic
    Export Vertical Text
    In This Topic

    DsExcel .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 -

    Refer to the following example code in order to export Vertical Text to PDF.

    C#
    Copy Code
    // 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 = "日本列島で使用されてきた言語である。MESCIUS";
    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, DsExcel will ignore the "@".