私のコンピューターには Excel 2007 があり、すべて正常に動作しますが、それを運用コンピューターに渡すと、2007 ではなく Excel 2003 があるため、グラフのタイトルを定義する際に問題が発生します。
チャートウィザードを使用して、2つのアプローチを試しました:
chartPage.ChartWizard(Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,"",Type.Missing,Type.Missing,)
および HasTitle:
chartPage.HasTitle = true;
chartPage.ChartTitle.Text = xlWorkSheet.Name.Replace(" Month", "");
どちらも私のコンピューターでは機能しますが、本番環境では機能しません。次の例外があります。
Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
at Microsoft.Office.Interop.Excel._Chart.set_HasTitle(Boolean RHS)
at DailyInfo.Program.cleanSheets(String inputExcelFile, String outputExcelFile)
at DailyInfo.Program.Main(String[] args)
C# .net 4.0 を使用して Excel 2003 ファイルのチャート タイトルを更新するにはどうすればよいですか?