Users of the Microsoft Office XP and 2003 programs Word, Excel, or PowerPoint—please install all High-Priority updates from Microsoft Update before downloading the Compatibility Pack.
By installing the Compatibility Pack in addition to Microsoft Office 2000, Office XP, or Office 2003, you will be able to open, edit, and save files using the file formats new to Word, Excel, and PowerPoint 2007. The Compatibility Pack can also be used in conjunction with the Microsoft Office Word Viewer 2003, Excel Viewer 2003, and PowerPoint Viewer 2003 to view files saved in these new formats. For more information about the Compatibility Pack, see Knowledge Base article 924074.
Note: If you use Microsoft Word 2000 or Microsoft Word 2002 to read or write documents containing complex scripts, please see http://support.microsoft.com/kb/925451 for information to enable Word 2007 documents to be displayed correctly in your version of Word.
Saturday, April 12, 2008
Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats
Posted by Fernando at 8:24 AM
0 comments Labels: data conversion, excel, office, utilities
Monday, February 4, 2008
Using Microsoft Excel within your ASP.NET application
If you add a reference to Microsoft Excel and then try to use it within your ASP.NET application you may receive the following error.
Server Error in '/excel' Application.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Example Application
The problem is that by default Microsoft Excel as a COM object can only activated by the following accounts:
- Administrator
- System
- Interactive
When you are running your ASP.Net account on Windows XP your web application is running as the ASPNET account.
The way to resolve this issue is to edit the DCOM configuration settings for the Microsoft Excel Application object.
Configure DCOM
- Go to the Start-Run menu item.
- Type in "DCOMCNFG" and hit enter.
- This should load the "Component Services" MMC (you can also load from Administrative Tools - Component Services"
- Expand "Component Services"
- Expand "Computers"
- Expand "My Computer"
- Select the "DCOM Config" item
- Select the "Microsoft Excel Application" item.
- Right click and select Properties
- Select the Security Tab and you should see the following:
- Under "Launch and Activation Permissions" select the "Customize" option.
- Click the "Edit" button
Windows XP
Windows 2003 Server
- Click the "Add" button to add a new account to the list.
- On the dialog that is displayed click the Locations button
(this is because by default your domain will be selected and we need a local account)
In this dialog scroll the list to the top (sometimes the first item is not visible) but scroll to the top and select the first item which is your computer name. In the list below "CCROWE" is the name of my computer.
- Click the OK button
- On the dialog that is displayed enter "ASPNET" as the account name (make sure location is set to the name of the computer that IIS is on) on Windows XP or if you are running on Windows 2003 Server you must enter the account that the Application Pool is running as, by default "Network Service"
Windows XP
Windows 2003 Server
Note: A quicker way on Windows XP is to just enter the computer name and the account
so in my case that would be:
ccrowe\ASPNET
- Click the OK button
- Now make sure you select the following options for the "ASP.NET Machine Account" or the account that is the application pool identity ( by default Network Service)
- Local Launch : Allow
- Remote Launch : [blank]
- Local Activation : Allow
- Remote Activation : [blank]
These settings can be seen below:
-
Windows XP
Windows 2003 Server
-
Click the OK button and test your web application again and it should work fine.
Note: Remember if you are running on Windows 2003 Server you must use the application pool identity as the account and not the ASPNET account.
Friday, February 1, 2008
Converting Excel dates (numeric) to regular dates
When importing dates from Excel, it is common to obtain a number instead of a date. That is the number of days after 1/1/1900.
private static string ConvertExcelDate(string strDate)
{
int iDate = 0;
if (! int.TryParse(strDate, out iDate))
return "";
DateTime dtDate = new DateTime(1900, 1, 1);
dtDate = dtDate.AddDays(iDate - 2);
return dtDate.ToShortDateString();
}
Posted by Fernando at 11:46 AM
0 comments Labels: C#, dates, excel