翻譯|使用教程|編輯:李顯亮|2019-06-19 15:02:02.147|閱讀 438 次
概述:Aspose.Words For .Net是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Aspose.Words For .Net是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。此外,API支持所有流行的Word處理文件格式,并允許將Word文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
【下載Aspose.Words for .NET最新試用版】
在MS Word中顯示文檔取決于在該文檔的默認值中設置的語言。但是,如果沒有語言設置為默認值,該怎么辦?在這種情況下,Word從“ 設置Office語言首選項 ”對話框中獲取信息,例如,可以在Word 2016中的“文件 - >選項 - >語言”菜單下找到。使用Aspose.Words,您可以設置語言首選項使用LanguagePreferences類。
下面的代碼示例顯示了如何將日語添加到編輯語言中:
//文檔目錄的路徑。 LoadOptions loadOptions = new LoadOptions(); loadOptions.LanguagePreferences.AddEditingLanguage(EditingLanguage.Japanese); Document doc = new Document(dataDir + @"languagepreferences.docx", loadOptions); int localeIdFarEast = doc.Styles.DefaultFont.LocaleIdFarEast; if (localeIdFarEast == (int)EditingLanguage.Japanese) Console.WriteLine("The document either has no any FarEast language set in defaults or it was set to Japanese originally."); else Console.WriteLine("The document default FarEast language was set to another than Japanese language originally, so it is not overridden.");
下面的代碼示例顯示如何將俄語設置為默認編輯語言:
//文檔目錄的路徑。 LoadOptions loadOptions = new LoadOptions(); loadOptions.LanguagePreferences.SetAsDefault(EditingLanguage.Russian); Document doc = new Document(dataDir + @"languagepreferences.docx", loadOptions); int localeId = doc.Styles.DefaultFont.LocaleId; if (localeId == (int)EditingLanguage.Russian) Console.WriteLine("The document either has no any language set in defaults or it was set to Russian originally."); else Console.WriteLine("The document default language was set to another than Russian language originally, so it is not overridden.");
如果要與其他人共享Word文檔,可以刪除個人信息,例如作者姓名和公司。您可以使用Document.RemovePersonalInformation屬性設置標志,指示Microsoft Word將在保存文檔時從注釋,修訂和文檔屬性中刪除所有用戶信息。
注意:在Aspose.Words中處理文檔時,設置此選項實際上不會刪除個人信息,并且僅影響Microsoft Word行為。
Document doc = new Document(dataDir + "Properties.doc"); doc.RemovePersonalInformation = true; dataDir = dataDir + "RemovePersonalInformation_out.docx"; doc.Save(dataDir);
ASPOSE技術交流QQ群(642018183)已開通,各類資源及時分享,歡迎交流討論!
慧都20萬+用戶答謝惠,ASPOSE系列產品火熱促銷中,最高直降8萬元!>>立即領取優惠
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn