Cell.GetRtfContent(RtfCellContentExportOptions) Method
Gets cell content as a string in RTF format. Allows you to specify export options.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
options | RtfCellContentExportOptions | A RtfCellContentExportOptions object that specifies export settings. |
Returns
Type | Description |
---|---|
String | The string that contains cell content in RTF format. |
Remarks
Use the GetRtfContent
method to export cell content to RTF with the specified export options and obtain the result as a string.
The IgnoreDisplayFormat option allows you to specify whether to ignore the display format.
Example
The following snippet loads a document from a file and exports content from cell B3. The IgnoreDisplayFormat property is set to true
:
using DevExpress.Spreadsheet;
using DevExpress.XtraSpreadsheet.Export;
//...
using (Workbook workbook = new Workbook()) {
workbook.LoadDocument("Documents\\Document.xlsx", DocumentFormat.Xlsx);
workbook.Calculate();
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet[4, 1]; //B3
RtfCellContentExportOptions rtfExportOptions = new RtfCellContentExportOptions();
rtfExportOptions.IgnoreDisplayFormat = true;
string rtfContentString = cell.GetRtfContent(rtfExportOptions);
}
The resulting HTML string looks as follows:
{\rtf1\deff0{\fonttbl{\f0 Calibri;}}{\colortbl;}{\fs22 cell with conditional formatting}}