Spread WPF Documentation
Exporting to HTML
Spread WPF Documentation > Developer's Guide > Managing Data > Exporting to HTML

Cell values, cell style information, spans, multiple headers, grid lines, grid line colors, and the control theme are saved to the HTML file.

The file contains the area down to the last cell with data.

The column width may be expanded in order to display all the text in the cell. Hidden rows and columns are also hidden in the HTML file.

Sparklines, group bars, the filter button, the sheet corner arrow, and the tab strip are not exported. Cell word wrap, cell overflow, frozen rows and columns, active cell outline, and the zoom option are also not exported.

If there are multiple viewports, the default viewport is saved.

You can use the SaveHtml method in code to save to an HTML file.

Using Code

The following example uses the SaveHtml method to save the sheet to a file.

CS
Copy Code
gcSpreadSheet1.Sheets[0].ShowGridLine = true;
gcSpreadSheet1.Sheets[0].GridLineColor = Color.FromRgb(150, 25, 199);
gcSpreadSheet1.Sheets[0].Cells[0, 0].Text = "test";
gcSpreadSheet1.Sheets[0].SaveHtml("c:\\zipfile\\test.html");
// or
// string fileName;
// fileName = "..\\..\\bin\\savespreadstream.csv";
// System.IO.Stream stream;
// stream = System.IO.File.Create(fileName);
// gcSpreadSheet1.Sheets[0].SaveHtml(stream);
VB.NET
Copy Code
GcSpreadSheet1.Sheets(0).ShowGridLine = True
GcSpreadSheet1.Sheets(0).GridLineColor = Color.FromRgb(150, 25, 199)
GcSpreadSheet1.Sheets(0).Cells(0, 0).Text = "test"
GcSpreadSheet1.Invalidate()
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
GcSpreadSheet1.Sheets(0).SaveHtml("c:\zipfile\test.html")
'or use a stream
'Dim fileName As String
' fileName = "c:\zipfile\savespreadstream.html"
'Dim stream As System.IO.Stream
'stream = System.IO.File.Create(fileName, System.IO.FileMode.Create)
'GcSpreadSheet1.Sheets(0).SaveHtml(stream)
'GcSpreadSheet1.Invalidate()
End Sub
See Also