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 shows how you can convert a workbook with bidirectional text to PDF and other file formats.

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

class Program
{
    static void Main()
    {
        // If using the 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 the 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

See also


Next steps

GemBox.Spreadsheet is a .NET component that enables you to read, write, edit, convert, and print spreadsheet files from your .NET applications using one simple API.

Download Buy