1
Word文書があり、RTF(またはHTML)形式のコンテンツをエクスポートしたいと思います。WordからRTFを取得する
Word.Application wordApp = new Word.Application();
Word.Document currentDoc = wordApp.Documents.Open("file.docx");
currentDoc.SaveAs("file.rtf", Word.WdSaveFormat.wdFormatRTF);
currentDoc = wordApp.Documents.Open("file.rtf");
Word.Range range = currentDoc.Range();
String RTFText = range.Text;
私は上記のコードを試しましたが、私はhteフォーマットなしでTextを取得するようです。
アイデア?あなたのために動作しませんあなたの方法を使用して
string rtf = File.ReadAllText("file.rtf");
:通常のテキストファイルのようにそれを開き
Word.Application wordApp = new Word.Application();
Word.Document currentDoc = wordApp.Documents.Open("file.docx");
currentDoc.SaveAs("file.rtf", Word.WdSaveFormat.wdFormatRTF);
そして:あなたはRTFコードを読みたい場合は
私は複雑な方法を考えていました。ありがとう! – Jaster