国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Asp.net Core使用Microsoft.Office.Interop.Word轉(zhuǎn)換文檔

這篇具有很好參考價值的文章主要介紹了Asp.net Core使用Microsoft.Office.Interop.Word轉(zhuǎn)換文檔。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

源代碼網(wǎng)絡(luò)上有很多,但是使用過程中發(fā)現(xiàn)問題還是有的,尤其是在文檔屬性配置不同的時候,出現(xiàn)的問題就是不能轉(zhuǎn)換。在開發(fā)端沒有問題,但在不同于開發(fā)端電腦的配置情況下,會出現(xiàn)意向不到的問題。此處對解決方案進行記錄。

using Word = Microsoft.Office.Interop.Word;

? public static bool ?WordToPdf(object sourcePath, string targetPath)
? ? ? ? {
? ? ? ? ? ? bool result = false;
? ? ? ? ? ? Word.WdExportFormat wdExportFormatPDF = Word.WdExportFormat.wdExportFormatPDF;
? ? ? ? ? ? object missing = Type.Missing;
? ? ? ? ? ? Microsoft.Office.Interop.Word.ApplicationClass applicationClass = null;
? ? ? ? ? ? Microsoft.Office.Interop.Word.Document document = null;
? ? ? ? ? ? try
? ? ? ? ? ? {
? ? ? ? ? ? ? ? applicationClass = new Microsoft.Office.Interop.Word.ApplicationClass();
? ? ? ? ? ? ? ? document = applicationClass.Documents.Open(ref sourcePath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
? ? ? ? ? ? ? ? if (document != null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? document.ExportAsFixedFormat(targetPath, wdExportFormatPDF, false, Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Word.WdExportRange.wdExportAllDocument, 0, 0, Word.WdExportItem.wdExportDocumentContent, true, true, Word.WdExportCreateBookmarks.wdExportCreateWordBookmarks, true, true, false, ref missing);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? result = true;
? ? ? ? ? ? }
? ? ? ? ? ? catch
? ? ? ? ? ? {
? ? ? ? ? ? ? ? result = false;
? ? ? ? ? ? }
? ? ? ? ? ? finally
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (document != null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? document.Close(ref missing, ref missing, ref missing);
? ? ? ? ? ? ? ? ? ? document = null;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? if (applicationClass != null)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? applicationClass.Quit(ref missing, ref missing, ref missing);
? ? ? ? ? ? ? ? ? ? applicationClass = null;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? return result;
? ? ? ? }

在啟動程序中輸入dcomcnfg命令,打開組件服務(wù),選定

Asp.net Core使用Microsoft.Office.Interop.Word轉(zhuǎn)換文檔

?設(shè)置其標(biāo)識為啟動用戶,可以快速解決很多問題。

Asp.net Core使用Microsoft.Office.Interop.Word轉(zhuǎn)換文檔

?文章來源地址http://www.zghlxwxcb.cn/news/detail-448226.html

到了這里,關(guān)于Asp.net Core使用Microsoft.Office.Interop.Word轉(zhuǎn)換文檔的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • C#用Microsoft.Office.Interop.Word生成WORD公式

    using Word = Microsoft.Office.Interop.Word; ? ? ? ? ? ? ? ? ?Word.Application myWord = new Word.Application(); ? ? ? ? ? ? ? ?myWord.Visible = true; ? ? ? ? ? ? ? ?object missing = System.Reflection.Missing.Value; ? ? ? ? ? ? ? ?Word.Document myDocument = myWord.Documents.Add(ref missing); ? ? ? ? ? ? ? ?//頁邊距 ?

    2024年02月07日
    瀏覽(19)
  • microsoft.office.interop.word 怎樣 讀取 某個漢字 字體顏色為紅色

    SKY[管理]筱傑 @SKY[機器]筱淋 microsoft.office.interop.word 怎樣 讀取 某個漢字 字體顏色為紅色呢? 要讀取某個漢字的字體顏色是否為紅色,您可以使用Microsoft.Office.Interop.Word來進行操作。以下是一個示例代碼,可以幫助您實現(xiàn)該功能: 請注意,您需要替換\\\"your_document_path.docx\\\"為您要

    2024年02月09日
    瀏覽(22)
  • OFFICE報錯:無法將類型為“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 對象強制轉(zhuǎn)換為接口類型

    OFFICE報錯:無法將類型為“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 對象強制轉(zhuǎn)換為接口類型

    無法將類型為“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 對象強制轉(zhuǎn)換為接口類型“Microsoft.Office.Interop.Excel._Application”。此操作失敗的原因是對 IID 為“{000208D5-0000-0000-C000-000000000046}”的接口的 COM 組件調(diào)用 QueryInterface 因以下錯誤而失敗: 庫沒有注冊。 (異常來自 HRESULT:0x

    2024年02月11日
    瀏覽(26)
  • 未能加載文件或程序集“Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=7
  • 使用Microsoft.Office.Interop.PowerPoin遙控PPT

    使用Microsoft.Office.Interop.PowerPoin遙控PPT

    代碼下載地址 有問題可聯(lián)系 1320271314

    2024年02月03日
    瀏覽(25)
  • C#使用Microsoft.office.interop.PowerPoint生成PPT

    開發(fā)的一個系統(tǒng)需要用到自動生成ppt,網(wǎng)上的例子比較少,且有很多還需要csdn幣下載,有些下載下來了還不是那么回事,就是個坑。后來考慮了開源組件Apose.Slides和Spire.Presentation,但是這兩個都是商業(yè)軟件,試用版和免費版的只有能生成前10頁,還帶有水印。Free Spire.Presentat

    2024年02月11日
    瀏覽(29)
  • c# 使用Microsoft.Office.Interop.Excel 對Excel操作

    c# 使用Microsoft.Office.Interop.Excel 對Excel操作

    提示:文章寫完后,目錄可以自動生成,如何生成可參考右邊的幫助文檔 文章目錄 前言 一、pandas是什么? 二、使用步驟 1.引入庫 2.讀入數(shù)據(jù) 總結(jié) Microsoft.Office.Interop.Excel的讀取,保存,內(nèi)容寫入和打印。 提示:以下是本篇文章正文內(nèi)容,下面案例可供參考 ? ? 首先于Proj

    2024年02月03日
    瀏覽(32)
  • 關(guān)于使用Microsoft.Office.Interop.Excel.dll來讀寫Excel表格的問題

    關(guān)于使用Microsoft.Office.Interop.Excel.dll來讀寫Excel表格的問題

    小公司,使用打卡機進行考勤,輸出的是一張Excel表格,每個月看到前臺妹子都要辛辛苦苦地統(tǒng)計Excel表格每個員工遲到的時間,于是想著寫一個自動計算遲到分鐘的小程序。 參照這幾篇比較好的文章按部就班地做:導(dǎo)出Excel文件 、其它方法。 沒想到剛開始寫就遇到一個大坑

    2024年02月16日
    瀏覽(25)
  • Build Word Processing Apps with ASP.NET Core 8

    Build Word Processing Apps with ASP.NET Core 8

    TX Text Control .NET Server for ASP.NET supports .NET 8 in ASP.NET Core applications. TX Text Control .NET Server for ASP.NET is a comprehensive server-side document processing library for ASP.NET and ASP.NET Core. Features include PDF processing, electronic signatures, file conversion, and reporting / mail merge. It supports client-side frameworks such as J

    2024年02月02日
    瀏覽(52)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包