![](/img/trans.png)
[英]How do i get specific columns from a thenInclude using .net-core and Entity Framework Core and Identity?
[英]how to transfer information from (.docx format) to (.docm format) using .Net-Core?
如何从 DOCX 转换为 DOCM?
在本文档中,有一个从docm 到docx 的转换。
我们可以做相反的事情(DOCX 到 DOCM)吗?
public void ConvertDOCXtoDOCM(string fileName)
{
bool fileChanged = false;
using (WordprocessingDocument document =
WordprocessingDocument.Open(fileName, true))
{
document.ChangeDocumentType(
WordprocessingDocumentType.MacroEnabledDocument);
// Track that the document has been changed.
fileChanged = true;
}
// If anything goes wrong in this file handling,
// the code will raise an exception back to the caller.
if (fileChanged)
{
// Create the new .docx filename.
var newFileName = Path.ChangeExtension(fileName, ".docm");
// If it already exists, it will be deleted!
if (File.Exists(newFileName))
{
File.Delete(newFileName);
}
// Rename the file.
File.Move(fileName, newFileName);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.