将Excel导出为带有网格线的HTML
Contents
[
Hide
]
如果您希望将 Excel 文件导出为带有 GridLines 的 HTML,请使用 HtmlSaveOptions.ExportGridLines 属性并将其设置为 true。
将Excel导出为带有网格线的HTML
下面的示例代码创建一个工作簿并填充其工作表的一些值,然后在将 HtmlSaveOptions.ExportGridLines 设置为 true 后以 HTML 格式保存它。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create your workbook | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
// Fill worksheet with some integer values | |
for (int r = 0; r < 10; r++) | |
{ | |
for (int c = 0; c < 10; c++) | |
{ | |
ws.Cells[r, c].PutValue(r * 1); | |
} | |
} | |
// Save your workbook in HTML format and export gridlines | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.ExportGridLines = true; | |
wb.Save(dataDir + "ExportToHTMLWithGridLines_out.html", opts); |