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

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Spreadsheet yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.