0
我寫了一個程序來做到這一點,但有一個例外,說使用未安裝Microsoft Office的C#着色Excel工作表單元格?
Retrieving the COM class factory for component with
CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 80040154
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
如何解決這個例外,我該如何使用C#來顏色的Excel工作表細胞?
下面是代碼:
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Windows;
using System.Drawing;
using Microsoft.Office.Interop.Excel;
using System;
namespace Project32
{
public class Class1
{
static void Main()
{
Application excel = new Application();
Workbook wb = excel.Workbooks.Open(@"C:\Users\mvmurthy\Downloads\IDBDeviceReport.rdlc");
Worksheet ws = wb.Worksheets[1];
ws.Cells[1, 1].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
}
}
}
有什麼問題嗎?這是關於你得到的例外或你的文章的標題? –
有沒有解決這個異常的解決方案,否則解決方案標題會很好 – manvitha