Right-to-Left Text

With GemBox.Spreadsheet, you can work with workbooks that contain bidirectional texts. This includes languages that use right-to-left script such as Arabic, Persian, Urdu, Hebrew, or Yiddish. Besides read and write support for XLSX and XLS formats, GemBox.Spreadsheet supports rendering of bidirectional texts to PDF, XPS, and image file formats.

You can use the CellStyle.TextDirection property to specify the reading order of a cell or the ExcelViewOptions.ShowColumnsFromRightToLeft property to specify the direction of the worksheet.

The following example demonstrates how to convert a workbook with bidirectional text to PDF and other file formats.

Screenshot of converted PDF
Converted PDF with bidiretional text
Upload your file (Drag file here)
using GemBox.Spreadsheet;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        var workbook = ExcelFile.Load("%InputFileName%");
        var worksheet = workbook.Worksheets[0];

        // Show columns from the right side of the page.
        worksheet.ViewOptions.ShowColumnsFromRightToLeft = true;


        worksheet.Cells["A8"].Value = "200 جديدة";
        // Set the reading order of the cell as right-to-left.
        worksheet.Cells["A8"].Style.TextDirection = TextDirection.RightToLeft;

        workbook.Save("RightToLeft.%OutputFileType%");
    }
}
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        Dim workbook = ExcelFile.Load("%InputFileName%")
        Dim worksheet = workbook.Worksheets(0)

        ' Show columns from the right side of the page.
        worksheet.ViewOptions.ShowColumnsFromRightToLeft = true


        worksheet.Cells("A8").Value = "200 جديدة"
        ' Set the reading order of the cell as right-to-left.
        worksheet.Cells("A8").Style.TextDirection = TextDirection.RightToLeft

        workbook.Save("RightToLeft.%OutputFileType%")
    End Sub

End Module

Check next example or download examples from GitHub.