# Saving to an HTML Table

Learn how to save individual sheets or cell ranges to HTML tables for web display. Get detailed specifications of HTML elements and their attributes.

## Content

You can save an individual sheet or a range of cells in a sheet to an HTML table in a file or stream if you need to display the sheet in a Web browser. This does not save the entire spreadsheet, only an individual sheet.
The HTML export saves as much of the formatting information or presentation-related settings as possible, depending on whether that information can be translated to an HTML element or attribute. The header cells are not saved out to XML; only the data area cells. If you have grouping turned on, only the data area of the sheet (not the grouping bar at the top, and not the group heading rows) is saved.
To save the sheet to an HTML table, use the [SaveHtml](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveHtml.html) methods of the [SheetView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.html) class.

> !type=note
> **Note:** The HTML export methods will not work with client profiling.

To save a range of cells on a sheet to an HTML table, use the [SaveHtmlRange](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveHtmlRange.html) methods of the [SheetView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.html) class.
In the example below, notice that the entire file is in a single element and that each of the cells, both headings and data area, are translated to table cells. Heading cells are output as elements (table heading cells) and data area cells are output as elements (table data cells). All of the formatting information is preserved and kept as attributes in the table cell attributes. A set of elements (column groups) define the width of the columns in the table. The appearance of the spreadsheet is reproduced as closely as possible in HTML in this fairly simple organization.
For detailed specifications of the HTML elements and their attributes, refer to the World Wide Web Consortium (W3C) ([https://www.w3.org](https://www.w3.org/)) HTML 4.01 reference site ([https://www.w3.org/TR/html4/](https://www.w3.org/TR/html4/)).

> !type=note
> **Note:** The [SaveHTML methods](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveHtml.html) are not supported in .NET Core 3.1 and .NET 6. However, they can be used in a .NET full-framework project.

## Using Code

Use the [SaveHtml](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveHtml.html) method.

## Example

This example uses the [SaveHtml](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveHtml.html) method.

```csharp
fpSpread1.ActiveSheet.SaveHtml("C:\\testfiles\\FPSpread-SheetToHTML.html");
```

```vbnet
fpSpread1.ActiveSheet.SaveHtml("C:\testfiles\FPSpread-SheetToHTML.html")
```

This gives the following result:

```html
<table cellspacing="0" cellpadding="0"
rules="all" border="1" style="border-width:1px;border-style:solid;width:548px;border-collapse:collapse;">
  <COLGROUP>
     <col width=49px>
     <col width=150px>
     <col width=300px>
     <col width=49px>
   </COLGROUP>
   <tr style="height:20px;">
     <th style="background-color:#A9A9A9;"></th>
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Artist</th>
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Website</th>
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">id</th>
   </tr>
   <tr style="height:20px;">
   <th align="center"
valign="middle" 
style="color:White;background-color:#A9A9A9;"></th>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Aerosmith</td>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">http://www.aerosmith.com/detect.html</td>
     <td align="right" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">0</td>
   </tr>
   <tr style="height:20px;">
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;"></th>
     <td align="left" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Foreigner</td>
     <td align="left" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">http://www.foreigneronline.com/</td>
     <td align="right" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">1</td>
   </tr>
   <tr style="height:20px;">
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;"></th>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Jimi Hendrix</td>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">http://www.jimi-hendrix.com/</td>
     <td align="right" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">2</td>
   </tr>
   <tr style="height:20px;">
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;"></th>
     <td align="left" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">Pink Floyd</td>
     <td align="left" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">http://www.pinkfloyd.com</td>
     <td align="right" valign="top" style="color:Gray;background-color:#DCDCDC;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">3</td>
   </tr>
   <tr style="height:20px;">
     <th align="center" valign="middle" style="color:White;background-color:#A9A9A9;"></th>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">The
Who</td>
     <td align="left" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">http://www.thewho.net/</td>
     <td align="right" valign="top" style="color:Gray;background-color:#F8F8FF;font-family:Arial;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;">4</td>
   </tr>
</table>
```

## See Also

[Saving to a Spread XML File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-spreadfile)
[Saving to an Excel File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-excelfile)
[Saving to a Text File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-texttfile)
[Storing Excel Summary and View](/spreadnet/docs/latest/online-win/overview/spwin-devguide/StoringExcelSummaryandView)
[Saving Spreadsheet Data to Simple XML](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-dataxml)