rtf ドキュメントは、このデータベースからの情報を使用して、データベース アプリケーションによって生成されます。データを取得して Excel ファイルに記録するソフトウェア (C#、ネット フレームワーク 4.5) を作成しました。
rtf ファイルのフッターを読まなければなりません。
ただし、ソフトウェアがフッターにアクセスする場合、フッター/ヘッダーがアクティブな場合のドキュメント ビューは同じです (Word の下にいるときに、ヘッダー/フッターをダブルクリックしてアクセスした場合と同じ効果です)。このアクション アクションは、ヘッダーにキャリッジ リターンを追加します。 (単語はこれを追加して何かを入力します)、この \r によりページが追加されます。
ここにコード:
Sections oSection = cGlobalVar.varWordApp.ActiveDocument.Sections;
HeaderFooter oFooter = oSection[1].Footers[WdHeaderFooterIndex.wdHeaderFooterFirstPage];
Range oRange = oFooter.Range.Tables[1].Range;//<= at this point, footer is accessible, the empty header of original document has a\r character, causing 2nd page to document that I don't want
strBuffer = oRange.Text;//<= information I need
oRange = oSection[1].Range.Tables[1].Range;//<= try to affect something else to oRange
oFooter = null;//<= try to null the object
oSection = null;//<= same as above
//cGlobalVar.varWordDoc.ActiveWindow.View.Type = WdViewType.wdPrintView;//<= try to use this to return to a normal state
元の文書 (1 ページ) に戻すために Word を操作しようとしましたが、成功しませんでした。