2
我試圖將html文件轉換爲MS word(docx)文件。 使用Microsoft.Office.Interop.Word我能夠從HTML轉換爲Word,但字體大小不一樣的文件的HTML和Word格式。 無論我在HTML中做什麼格式(字體大小)都在Word文件中丟失。任何人都可以幫助我保留相同的字體大小。字體大小不一樣,當html轉換爲Word使用Microsoft.Office.Interop.Word
下面是代碼:
Microsoft.Office.Interop.Word.Document wordDoc = new Microsoft.Office.Interop.Word.Document();
wordDoc = wordApp.Documents.Open(ref filepath, ref confirmconversion, 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);
object fileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocumentDefault;
wordDoc.SaveAs(ref saveto, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oallowsubstitution, ref oMissing, ref oMissing);
謝謝!