使用ByteScout电子表格在Excel文件中写入多个表格

我有几个DataTable对象,我想写他们到一个Excel文件,但各种表。

我正在使用bytescout.spreadsheet来处理Excel文件。

如何使用此工具和C#编写多个表格来优化文件?

阅读手册: http : //bytescout.com/products/developer/spreadsheetsdk/bytescoutxls_working_with_worksheets_in_xls_document.html

using System; using System.Collections.Generic; using System.Text; using Bytescout.Spreadsheet; namespace Worksheets { internal class Program { private static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); // Add worksheets Worksheet worksheet1 = document.Workbook.Worksheets.Add("Demo worksheet 1"); Worksheet worksheet2 = document.Workbook.Worksheets.Add("Demo worksheet 2"); // Get worksheet by name Worksheet worksheetByName = document.Workbook.Worksheets.ByName("Demo worksheet 2"); // Set cell values worksheet1.Cell(0, 0).Value = "This is Demo worksheet 1"; worksheetByName.Cell(0, 0).Value = "This is Demo worksheet 2"; // Save document document.SaveAs("Worksheets.xls"); } }