Hi,
I am trying to read an excel file and display the data from the excel file on to a WPF form. Is there anyway I can display the rich text (cell) content from Excel to a WPF form ?
I am able to retrieve the formatted cell content from excel and access the field which is of type Infragistics.Documents.Excel.FormattedString. How do I display the formattedstring on a wpf form ? do we have any controls to display these type of fields ?
Thanks
Raghu
Hello Raghu,
I am just checking if you have any other questions on the matter.
Hi Raghu,
I might have misunderstood you so I just would like to share a little more details on the FormattedString. XamSpreadSheet renders the FormattedString object but not a single instance. It would render the Workbook and the cell would render as rich text if the cell’s value is a FormattedString. If you would like to display the FormattedString elsewhere you would probably need to enumerate the font information from the FormattedString using the GetFormattingRuns and then create some other format (e.g. TextRuns might be created and added to a Paragraph in a FlowDocument). This approach is similar to the one that is implemented internally for the XamSpreadSheet. Please note that some of the format settings (e.g. double underline, super/subscript, etc) do not translate properly on the TextRun. Currently there is no publically available approach that would help you achieve this. In case you would like to see it in one of our future versions you can add it as a new suggestion at: http://ideas.infragistics.com
When it comes to importing and exporting rich text content I would suggest you to use the XamRichTextEditor as it was created to cope with rich text content: http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/xamRichTextEditor_Managing_Import_Export_RTF.html#_Ref362603137. The documentation page above illustrates how the export and import could be handled within this control.If you prefer to use the Excel engine and create a workbook, you can use the CellFormat to format the content of the cell though it will not be a rich content: http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/IGExcelEngine_Copy_a_Cells_Format.html.