C# 如何将excel文件与devexpress合并
我正在尝试将两个Excel文件与Devexpress库合并。我没有任何错误,但没有发生任何事情。调试也看起来不错。我可以看到工作表名称等 我使用本手册合并文件。 没有人工作 xlsx文档放在bin\Debug文件夹中。图纸包含图纸1,其中有不同的数据 代码C# 如何将excel文件与devexpress合并,c#,devexpress,filemerge,C#,Devexpress,Filemerge,我正在尝试将两个Excel文件与Devexpress库合并。我没有任何错误,但没有发生任何事情。调试也看起来不错。我可以看到工作表名称等 我使用本手册合并文件。 没有人工作 xlsx文档放在bin\Debug文件夹中。图纸包含图纸1,其中有不同的数据 代码 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using Syste
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Data.OleDb;
using DevExpress.Spreadsheet;
using System.Drawing;
using DevExpress.XtraSpreadsheet;
using DevExpress.Docs;
namespace Merge_Files
{
class Program
{
static void Main(string[] args)
{
// Create the first workbook.
Workbook book1 = new Workbook();
book1.LoadDocument("Test1.xlsx", DocumentFormat.Xlsx);
// Create the second workbook.
Workbook book2 = new Workbook();
book2.LoadDocument("Test2.xlsx", DocumentFormat.Xlsx);
// Copy all worksheets from "Document1" to "Document2".
book2.Append(book1);
}
}
}
我认为您需要使用该方法将您的更改保存到物理文件中。您应该调用book2.SaveDocument(“Text2.xlsx”)来完成此任务。非常感谢Brendon。它工作得很好。