110,580
社区成员
发帖
与我相关
我的任务
分享
Microsoft.Office.Interop.Word._Application oWord = null;
Microsoft.Office.Interop.Word._Document oDoc;
oWord = new Microsoft.Office.Interop.Word.Application();
//oWord.Visible = true;
object ReadOnly = true;
oWord.ActivePrinter = "Microsoft Office Document Image Writer";
oDoc = oWord.Documents.Open(ref tempFileName,
ref oMissing, ref ReadOnly, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
try
{
// if (!Directory.Exists(savePath.ToString()))
// {
// Directory.CreateDirectory(savePath.ToString());
// }
savePath = sPath;//+ strFileName + "." + astdt;
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;
oDoc.SaveAs(ref savePath, ref format,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Microsoft.Office.Interop.Word.WdStatistic stat = Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages;
pageNum = oDoc.ComputeStatistics(stat, ref oMissing);
捕捉到 System.Runtime.InteropServices.COMException
HelpLink="C:\\Program Files\\Microsoft Office\\Office12\\2052\\WDMAIN11.CHM#36966"
Message="命令失败"
Source="Microsoft Word"
ErrorCode=-2146824090
StackTrace:
在 Microsoft.Office.Interop.Word.DocumentClass.SaveAs(Object& FileName, Object& FileFormat, Object& LockComments, Object& Password, Object& AddToRecentFiles, Object& WritePassword, Object& ReadOnlyRecommended, Object& EmbedTrueTypeFonts, Object& SaveNativePictureFormat, Object& SaveFormsData, Object& SaveAsAOCELetter, Object& Encoding, Object& InsertLineBreaks, Object& AllowSubstitutions, Object& LineEnding, Object& AddBiDiMarks)
在 UploadSystem.Doc2Swf.ToPdf(String path, String sPath, String sImagesPath) 位置 E:\web\Wendang\UploadSystem\Convert.cs:行号 66
InnerException: null