c# - 如何使用 XMLMap 和 EPPlus 导出 Excel 数据
问题描述
我想知道是否有人可以帮助我在 EPPlus 或 OpenOffice XML 中实现以下 C# 代码:
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
string excelFileName = "Sample.xlsx";
string currentDirectory = Directory.GetCurrentDirectory();
string excelFilePath = System.IO.Path.Combine(currentDirectory, excelFileName);
app.Workbooks.Open(excelFilePath,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
string xmlContent = string.Empty;
// Use the map (XSD inside the Excel file)
app.ActiveWorkbook.XmlMaps[1].ExportXml(out xmlContent);
app.Workbooks.Close();
使用 Microsoft.Office.Interop.Excel.Application 需要在服务器上安装 Microsoft Office。除了安装 Microsoft Engine 之外,还有什么方法可以解决这个问题吗?基本上如何在没有 office.Interop 的情况下读取 XMLMap?
谢谢
解决方案
推荐阅读
- javascript - 如何锁定不断变化的js npm包的依赖关系?
- autodesk-forge - 锻造设计自动化:FailedInstructions
- javascript - 使用 javascript 显示 html 标签
- jestjs - MSW 与 Jest(困惑)
- python - Gitlab:如何使用/切换可用性很高的组跑步者
- r - 基于公共列组合数据集
- spring - 将对象列表设置为请求正文:Spring WebClient
- azure - 重命名用户属性 - Azure AD B2C
- bash - 选择特定字段并将它们写入新文件
- excel - 如何将带有点分隔符的 Excel 不断变化的数字自动反转为日期格式?