- 216 名前:デフォルトの名無しさん [2008/03/03(月) 23:25:39 ]
- 211です
// Excel を起動しファイルを読み込む // ※ Excel ファイルのパスは適宜修正してください Excel.Application app = new Excel.Application(); Excel._Workbook wb = app.Workbooks.Open( @"C:\test\test.xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing ); wb.Application.Visible = false; // 人口のデータを配列に読み込む Excel._Worksheet ws = (Excel.Worksheet)wb.ActiveSheet; ws.Cells[5, 5] = "テスト"; System.Runtime.InteropServices.Marshal.ReleaseComObject(ws.Cells); // ファイルをセーブし、Excel を終了する wb.Save(); app.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(ws); System.Runtime.InteropServices.Marshal.ReleaseComObject(wb); System.Runtime.InteropServices.Marshal.ReleaseComObject(app); これでは解放しない??
|

|