Visual Studio 2010 VB.NET 4.0 Windows アプリケーション プロジェクトがあります。コードは Word 2010 文書にデータを入力しています。30 から 60 のテーブルの領域のどこかに、30 から 50 の埋め込みグラフの領域のどこかにあります (すべてインライン形状 ( InlineShape
) として定義されています)。
Document.Save()
次のエラーが発生したため、通常の呼び出しを開始する必要がありました: There are too many edits in the document. This operation will be incomplete. Save your work.
. 利用可能なディスク容量とメモリも十分にあります。
ほとんどの場合、.Save()
動作しますが、呼び出されたときにランダムに [名前を付けて保存] ダイアログが表示さ.Save()
れます。ちなみに、クリックしてキャンセルすると、次のエラーが発生しますCommand failed at Microsoft.Office.Interop.Word.DocumentClass.Save()
。
以下は、何が起こっているかを理解するためのコードの抜粋です。
Imports _word = Microsoft.Office.Interop.Word
...
...
Dim wrd As _word.Application = CreateObject("Word.Application")
wrd.Visible = True
wrd.ScreenUpdating = True
Dim doc As _word.Document = wrd.Documents.Open("C:\my-file-template.docx")
doc.Application.DisplayAlerts = _word.WdAlertLevel.wdAlertsNone
doc.Range.NoProofing = True
Dim reportFilePathName As String = "C:\my-file.docx"
If File.Exists(reportFilePathName) Then
File.Delete(Me.reportFilePathName)
End If
doc.SaveAs2(reportFilePathName)
...
'Numerous tasks carried out
...
doc.Save() 'This may or may not cause the save as dialog to show
...
[名前を付けて保存] ダイアログが表示される理由を知っている人はいますか? 止めてもいいですか?
「編集が多すぎます」というエラーが表示されて、それほど多くの保存を行う必要がない理由はありますか (とにかくプロセスが遅くなります!)?