C# 使用xceed.words.net.docx写入docx,在VS中运行时有效,在运行编译exe时每页写入一行
我用这个已经有一段时间了,一直都很好用。项目在运行时写入docx日志文件。我最近修改了它写入日志的路径,以供其他人使用。从那时起,当我以内置exe运行它时,它每页写一行。但是,当我试图解决这个问题时,我无法在VS中运行它来重新创建它。从那里它可以像往常一样工作 有什么想法吗?有人能给我指个方向吗C# 使用xceed.words.net.docx写入docx,在VS中运行时有效,在运行编译exe时每页写入一行,c#,.net,docx,xceed,C#,.net,Docx,Xceed,我用这个已经有一段时间了,一直都很好用。项目在运行时写入docx日志文件。我最近修改了它写入日志的路径,以供其他人使用。从那时起,当我以内置exe运行它时,它每页写一行。但是,当我试图解决这个问题时,我无法在VS中运行它来重新创建它。从那里它可以像往常一样工作 有什么想法吗?有人能给我指个方向吗 public static void WritetoLogFile(string logUpdate) { DateTime now = D
public static void WritetoLogFile(string logUpdate)
{
DateTime now = DateTime.Now;
string logDate = now.ToString("MM-dd");
string folderNameDate = now.ToString("MM_dd_yyyy");
string folderName = folderNameDate + "_Logs";
string stateFolder = " ";
System.IO.Directory.CreateDirectory(Crawlspace.networkSharePath + "//" + folderName);
string logName = logDate + "_" + Crawlspace.browser + "_" + Crawlspace.computerName + "_" + Crawlspace.SuiteTable + ".docx";
Crawlspace.LogFileName = logName;
System.IO.Directory.CreateDirectory(Crawlspace.networkSharePath + folderName + "//" + stateFolder);
Crawlspace.LogFile = Crawlspace.networkSharePath + folderName + "//" + stateFolder + "//" + logName;
if (System.IO.File.Exists(Crawlspace.LogFile))
{
using (DocX document = DocX.Load(Crawlspace.LogFile))
{
Paragraph par1 = document.InsertParagraph();
par1.Append(logUpdate);
par1.Font("Courier New");
par1.FontSize(8);
document.Save();
}
}
else
{
using (DocX document = DocX.Create(Crawlspace.LogFile))
{
Paragraph par1 = document.InsertParagraph();
par1.Append(logUpdate);
par1.Font("Courier New");
par1.FontSize(8);
document.Save();
}
}
}
决议:
我检查了nuget管理器中的xceed.words.net.docx dll,发现有一个更新。更新至最新版本并修改了my using语句以反映更新,现在正在运行
using Image = Xceed.Document.NET.Image;
using Paragraph = Xceed.Document.NET.Paragraph;
using Picture = Xceed.Document.NET.Picture;
你觉得有人能帮上什么忙?你遗漏了很多细节。你到底改变了什么?输出是什么样子的,应该是什么样子的?