FlexCelHtmlExport Class
A component for exporting an Excel file to HTML.
Syntax
Namespace: FlexCel.Render
public class FlexCelHtmlExport: Component, IHtmlFontEvent
Constructors
Name | Description |
---|---|
FlexCelHtmlExport | Overloaded FlexCelHtmlExport FlexCelHtmlExport(ExcelFile) FlexCelHtmlExport(ExcelFile, Boolean) |
Methods
Properties
Name | Description |
---|---|
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. |
Progress | Progress of the export. This variable can be accessed from other thread or from the OnProgress event. |
Workbook | The ExcelFile to export. |
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. |
HtmlVersion | Version of the HTML generated. |
HtmlFileFormat | Format of the HTML file to be generated. |
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 an unique ClassPrefix. |
FixIE6TransparentPngSupport | By default, Internet explorer does not support transparent PNGs. Normally this is not an issue, since Excel does not use much 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. |
FixOutlook2007CssSupport | 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. |
FixIE6WordWrapSupport | 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 FixOutlook2007CssSupport...[more] |
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. |
HeadingWidth | Width in points of the left gutter when printing row numbers and column names. |
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 ("{}"). |
PrintRangeLeft | First 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. |
PrintRangeRight | Last column to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
PrintRangeBottom | Last row to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
AllowOverwritingFiles | Determines if FlexCel will automatically delete existing HTML and image files or not. |
IgnoreSharingViolations | 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 AllowOverwritingFiles is false, this property has no effect. |
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. |
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. |
LinksInNewWindow | If true, the links will be exported with a target=_blank attribute so they open in a new window. |
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" |
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%. |
ImageResolution | Resolution for the exported images. The bigger the resolution, the bigger the image size and quality. Use 96 for standard screen resolution. |
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 FixIE6TransparentPngSupport |
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 |
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 |
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 |
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 FixIE6TransparentPngSupport to true), and then you could use Colors.White here. |
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. |
ImageNaming | This property defines how the images will be named by FlexCel. You can always override the name using the GetImageInformation event. |
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 |
ExtraInfo | Extra information to be added to the HTML file. |
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. |
Events
Name | Description |
---|---|
GetImageInformation | Use this event to customize where to save the images when exporting to HTML. |
SaveImage | Use this event to save the images into other place. Note that this event only fires when saving HTML, not MTHML. |
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. |