How to convert an Excel workbook to RTF document in C# and VB.Net .NET Core?

How to convert an Excel workbook to RTF document in C# and VB.Net .NET Core?

Excel to PDF .Net

.Net assembly to convert Excel (.xls and .xlsx) workbooks to PDF, RTF, DOCX, Word in .Net and C#.
How to convert an Excel workbook to RTF document in C# and VB.Net .NET Core?

Excel to PDF .Net

How to convert an Excel workbook to RTF document in C# and VB.Net .NET Core?
How to convert an Excel workbook to RTF document in C# and VB.Net .NET Core?

Introduction

If you are looking for a .NET library to extract convert Excel workbook to RTF format, you are in the right place. Our component helps you convert any .xls and .xlsx document to Word (RTF).

During the conversion process you may: select custom sheets and area of cells for conversion, specify page properties, add page numbers.

To illustrate how to easily convert Excel workbook to Word (RTF), let's look at simple code in C#:

  1. Add a reference to the "SautinSoft.Excel.dll":

    How to add the reference to the SautinSoft.Excel.dll
  2. Type this C# code:

    
              SautinSoft.ExceltoPdf x = new SautinSoft.ExceltoPdf();
    x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Rtf;
    x.ConvertFile(@"d:\Table.xlsx", @"d:\Table.rtf");
    

Download

To see this functionality firsthand, download the freshest «Excel to PDF .Net» with code examples, 49.4 Mb.

Limitations

Excel to PDF .Net The limitations of the free version are: The trial notice "Created by unlicensed version of Excel to PDF .Net" and the random addition of the word "TRIAL".


Some examples to convert Excel to RTF in C# and VB.Net

1. Let us say, to convert an Excel workbook to RTF file within C# application:

static void Main(string[] args)
{
    // Convert Excel file to RTF file
    ExcelToPdf x = new ExcelToPdf();

    // Set RTF as output format.
    x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Rtf;

    string excelFile = @"c:\MyTable.xls";
    string rtfFile = Path.ChangeExtension(excelFile, ".rtf"); ;

    try
    {
        x.ConvertFile(excelFile, rtfFile);
        System.Diagnostics.Process.Start(rtfFile);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        Console.ReadLine();
    }
}

2. Convert .xls to .rtf in memory within VB.Net application:

Public Sub ConvertExcelAsMemoryStream()
    ' Convert Excel to RTF in memory
    Dim x As New ExcelToPdf()

    ' Set RTF as output format.
    x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Rtf

    Dim excelFile As String = "d:\MyBook.xls"
    Dim rtfFile As String = Path.ChangeExtension(excelFile, ".rtf")
    Dim rtfBytes() As Byte = Nothing

    Try
        ' Let us say, we have a memory stream with Excel data.
        Using ms As New MemoryStream(File.ReadAllBytes(excelFile))
            rtfBytes = x.ConvertBytes(ms.ToArray())
        End Using
        ' Save rtfBytes to a file for demonstration purposes.
        File.WriteAllBytes(rtfFile, rtfBytes)
        System.Diagnostics.Process.Start(rtfFile)
    Catch ex As Exception
        Console.WriteLine(ex.Message)
        Console.ReadLine()
    End Try
End Sub

Requirements and Technical Information

«Excel to PDF .Net» can be used on 32 and 64-bits platforms with .NET Framework 4.0, .NET Core 2.0 and higher. The component doesn't require Microsoft Excel or any other software. It's absolutely standalone and independent library.

Our product is compatible with all .NET languages and supports all Operating Systems where .NET Framework and .NET Core can be used. Note that «Excel to PDF .Net» is entirely written in managed C#.

.Net Framework 4.0 and higher and .Net Core 2.0 and higher

.NET Framework 4.0, 4.5, 4.6.1 and higher.

.NET Core 2.0 and higher.


Multi-platform component, runs on:


Our component has proven itself on cloud platforms and services:

  • Microsoft Azure
  • Amazon Web Services (AWS)
  • Google Cloud Platform
  • SharePoint
  • Docker
  • etc.

If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: