Có cách nào để chuyển đổi tài liệu Word nơi tôi có một số bảng vào tệp Excel không? Sẽ rất hữu ích khi chuyển đổi bảng.Chuyển đổi Word docx sang Excel bằng OpenXML
Something như thế:
- mở tài liệu Word sử dụng OpenXML
- Tìm tất cả các bảng xml-thẻ
- Sao chép xml-thẻ
- Tạo tập tin Excel
- Chèn xml-thẻ với bảng từ tệp Word sang Excel mới
Ý tôi là
void OpenWordDoc(string filePath)
{
_documentWord = SpreadsheetDocument.Open(filePath, true);
}
List<string> GetAllTablesXMLTags()
{
//find and copy
}
List<string> CreateExcelFile(string filePath)
{
TemplateExcelDocument excelDocument = new TemplateExcelDocument();
_documentExcel = excelDocument.CreatePackage(filePath);
}
void InsertXmlTagsToExcelFile(string filePath)
{
CreateExcelFiles(filePath);
var xmlTable = GetAllTablesXMLTags();
// ... insert to _documentExcel
}
Thật không may, tôi cần chức năng tương tự nhưng sử dụng OpenXML –