Table of Contents

FlexCelHtmlExport Class

A component for exporting an Excel file to HTML.

Syntax

Namespace: FlexCel.Render

public class FlexCelHtmlExport: Component, IHtmlFontEvent

Constructors

Methods

Name Description
Cancel Cancels a running export. This method is equivalent to setting Canceled = true.
DoHtmlFont This method is for internal use.
Export Overloaded
Export(String, String)
Export(TextWriter, String, TCssInformation)
Export(String, String, TCssInformation)
Export(String, String, String)
ExportAllVisible​Sheets​AsOne​Html​File Overloaded
ExportAllVisibleSheetsAsOneHtmlFile(String, String, String, String)
ExportAllVisibleSheetsAsOneHtmlFile(TextWriter, String, String, String, String)
ExportAllVisible​Sheets​AsTabs Overloaded
ExportAllVisibleSheetsAsTabs(String, String, String, String, String, TSheetSelector)
ExportAllVisibleSheetsAsTabs(String, String, String, String, String, TSheetSelector, OnSheetNameEventHandler)
ExportToClipboard​Format Exports the file in the format expected by the CT_HTML clipboard format: https:​//​msdn.​microsoft.​com/​en-​us/​library/​windows/​desktop/​ms649015(​v=​vs.​85)​.aspx
OnGetImageInformation Replace this event when creating a custom descendant of FlexCelHtmlExport.
OnHtmlFont Replace this event when creating a custom descendant of FlexCelHtmlExport.
OnNamedRangeExport Replace this event when creating a custom descendant of FlexCelHtmlExport.
OnSaveImage Replace this event when creating a custom descendant of FlexCelHtmlExport.
PartialExportAdd Overloaded
PartialExportAdd(TPartialExportState, String, String)
PartialExportAdd(TPartialExportState, String, String, Boolean)
ReplaceSeparator​Macros This method is for internal use. It will replace the sheet name, pos and count macros in a sheet separator.

Properties

Name Description
AllowOverwriting​Files Determines if FlexCel will automatically delete existing HTML and image files or not.
AntiAliased This affects how the text is rendered for example when exporting a chart. Some modes will look a little blurred but with better quality.
Consult the .NET framework documentation on SmoothingMode for more information
BackgroundColor Background color for empty cells. This is White by default, but you migth want to make it TUIColor.Empty if you want the cells to not cover the background.
BaseUrl If this property is not null, all hyperlinks stating with this value will be converted to relative links, by removing this string from them.

Hyperlinks in Excel must be absolute by default, so this property is a way to get relative hyperlinks.

For example, if BaseUrl is "https:​//​www.​tmssoftware.​com/​" and an Excel file has a link "https:​//​www.​tmssoftware.​com/​test.​html" the link in the generated HTML file will be "test.html"
Canceled If true the export has been canceled with Cancel method.
You can't set this variable to false, and setting it true is the same as calling Cancel.
ClassPrefix Prefix to be appended to all CSS classes. For example, if you set it to "test", CSS classes will be named like ".test1234". Normally you do not need to change this property, but if you need to insert multiple Excel files in the same HTML page, you need to ensure all classes have a unique ClassPrefix.
EmbedImages If true, images will be embedded in the HTML file using base64 encoded data uris as defined in http:​//​tools.​ietf.​org/​html/​rfc2397
ExportNamedRanges When true FlexCel will insert a span in the first cell of every named range with "id" = the name of the range.
You can access then this with javascript.
For a fine grain control of how names are exported, you can use NamedRangeExport event.
ExtraInfo Extra information to be added to the HTML file.
FixIE6Transparent​PngSupport By default, Internet explorer does not support transparent PNGs. Normally this is not an issue, since Excel uses little transparency. But if you rely on transparent images and don't want to use gif images instead of png, you can set this property to true. It will add special code to the HTML file to support transparent images in IE6.

Note: If setting this property to false, you might want to set ImageBackground to Colors.White instead of TUIColor.Empty to ensure images have no transparent background.
FixIE6WordWrap​Support Some older browsers (and Word 2007) might not support the CSS white-space tag. In this case, if a line longer than a cell cannot be expanded to the right (because there is data in the next cell) it will wrap down instead of being cropped. This fix will cut the text on this cell to the displayable characters. If a letter was displayed by the half on the right, after applying this fix it will not display.
This fix is automatically applied when FixOutlook2007Css​Support...[more]
FixOutlook2007Css​Support Outlook 2007 renders HTML worse than previous versions, since it switched to the Word 2007 rendering engine instead of Internet Explorer to show HTML emails. If you apply this fix, some code will be added to the generated HTML file to improve the display in Outlook 2007. Other browsers will not be affected and will still render the original file. Turn this option on if you plan to email the generated file as an HTML email or to edit them in Word 2007. Note that the pages will not validate with the w3c validator if this option is on.
GeneratedFiles Contains all the generated files by the component. Note that it might contain files not actually generated, if an error happened while trying to create them.
HasSaveImageEvent Override this property when creating your own OnSaveImage descendant. This method should return true if there is any event attached to it.
HeadingStyle Style definition for the gutter cells when printing row numbers or column names. This text must be a valid CSS style definition, without including the braces ("{}").
HeadingWidth Width in points of the left gutter when printing row numbers and column names.
HidePrintObjects Select which kind of objects should not be exported to html. By default we do *not* export headers and footers, since they are normally not what you want when exporting to HTML.
HtmlFileFormat Format of the HTML file to be generated.
HtmlVersion Version of the HTML generated.
IgnoreSharing​Violations When this property is true and the component tries to write any file that is locked by other thread, it will not raise an error and just assume the other thread will write the correct image. You will normally want to have this true, so you can have many threads writing to the same file without issues. Note that when AllowOverwriting​Files is false, this property has no effect.
ImageBackground When this property is set to TUIColor.Empty (the default), images will be rendered with a transparent background.
While this is the normal behavior, sometimes you might not want transparent images (for example to support Internet Explorer 6 without setting FixIE6Transparent​PngSupport to true), and then you could use Colors.White here.
ImageNaming This property defines how the images will be named by FlexCel. You can always override the name using the GetImageInformation event.
ImageResolution Resolution for the exported images. The bigger the resolution, the bigger the image size and quality. Use 96 for standard screen resolution.
InterpolationMode This affects how the images, charts, etc are rendered for the image file. Some modes will look a little blurred but with better quality.
Consult the .NET framework documentation on SmoothingMode for more information
LinksInNewWindow If true, the links will be exported with a target=_blank attribute so they open in a new window.
PrintRangeBottom Last row to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated.
PrintRangeLeft First column to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated.
PrintRangeRight Last column to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated.
PrintRangeTop First row to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated.
Progress Progress of the export. This variable can be accessed from other thread or from the OnProgress event.
RasterizeSVGImages If false (the default) then FlexCel will export SVG images inside the Excel file as SVG images inside the generated HTML.
If true, FlexCel will convert the SVG images to PNG and embed the PNG inside the HTML. This might be more accurate specially if the embedded SVG uses fonts that might not be present in the client machine. See S V G Files Inside Xlsx Files for more information.
SavedImagesFormat File format in which the images will be saved. Note that Ie6 does not support transparency in PNGs by default, so if you have transparent images and you want to make you page compatible with IE6, you should save as gif or use FixIE6Transparent​PngSupport
SmoothingMode This affects how the images, charts, etc are rendered for the image file. Some modes will look a little blurred but with better quality.
Consult the .NET framework documentation on SmoothingMode for more information
SpreadView The properties here make the generated file look more like when you view a Spreadsheet in Excel, and less like a printed page. By default, FlexCel tries to mimic the printed-page output, not the interactive view.
UseContentId When exporting to MHTML, some mail clients might have problems understanding the newer "Content-Location" header to show the images.
When this property is true, we will use the older "Content-Id" header that is better supported than Content Location in the mime headers to reference the images. You are strongly encouraged to keep this property true in order to maximize the number of mail readers compatible. When Exporting to HTML (not MHTML), this property has no effect.
UsePrintScale If false (the default) the print scale of the sheet will be ignored when exporting to html. If true, sheets will be exported honoring the zoom of the page.Note that if PrintToFit is true, then this value will be ignored and zoom will be 100%.
VerticalTextAsImages When true and text is vertical, FlexCel will replace the text with an image in order to show it correctly in HTML.
When false, text will be rendered normally without rotation.
Note that when using HTML5 this property is ignored, since HTML5 allows text rotation.
Workbook The ExcelFile to export.

Events

Name Description
GetImageInformation Use this event to customize where to save the images when exporting to HTML.
HtmlFont Use this event to customize the fonts used in the exported file.
NamedRangeExport Use this event to customize how a named range if exported to the HTML file. Note that for this event to be called, you first need to set ExportNamedRanges = true. If you want to change the id that will be exported or exclude certain named from being exported, you can do so here.
SaveImage Use this event to save the images into other place. Note that this event only fires when saving HTML, not MTHML.