您好我有以下用于将文件从 .xlsm 转换为 .xlsx 的代码片段。代码在 C# 中,但我需要它在 vb 中。请建议。
byte[] byteArray = File.ReadAllBytes("C:\\temp\\test.xlsm");
using (MemoryStream stream = new MemoryStream())
{
stream.Write(byteArray, 0, (int)byteArray.Length);
using (SpreadsheetDocument spreadsheetDoc = SpreadsheetDocument.Open(stream, true))
// Change from template type to workbook type
{
spreadsheetDoc.ChangeDocumentType (SpreadsheetDocumentType.Workbook);
}
File.WriteAllBytes ("C:\\temp\\test.xlsx", stream.ToArray());
}