Fp2003/owc11.msi
Reference
Microsoft Office Web Components 11.0
C:/program files/common files/Microsoft shared/Web Components/11/owc11.dll
Installation File office2003 installation CD/fp2003/owc11.msi
Office2003 CD/office11/owc11.msi
After office2003 is installed by default, I don't know if it was installed before. After installation, I can find this component in the studio2005 system.
However, this component is still unavailable in ASP.
'Check whether the component is supported and the subroutine of the component version
Sub objtest (strobj)
On Error resume next
Isobj = false
Verobj = ""
Set testobj = server. Createobject (strobj)
If-2147221005 <> err then' thanks to iamfisher for his valuable suggestions.
Isobj = true
Verobj = testobj. Version
If verobj = "" Or isnull (verobj) Then verobj = testobj. About
End if
Set testobj = nothing
End sub
Function detection failed
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
Using Microsoft. Office. InterOP. owc11;
Namespace msowc
{
Public partial class form1: Form
{
Public form1 ()
{
Initializecomponent ();
}
Private void button#click (Object sender, eventargs E)
{
Microsoft. Office. InterOP. owc11.spreadsheetclass xlsheet = new Microsoft. Office. InterOP. owc11.spreadsheetclass ();
// Merge Cells
Xlsheet. get_range (xlsheet. cells [1, 1], xlsheet. cells [1, 14]). set_mergecells (true );
Xlsheet. activesheet. cells [1, 1] = "Primary Account ";
// Bold font
Xlsheet. get_range (xlsheet. cells [1, 1], xlsheet. cells [1, 14]). Font. set_bold (true );
// Align the cell text horizontally.
Xlsheet. get_range (xlsheet. cells [1, 1], xlsheet. cells [1, 14]). set_horizontalalignment (Microsoft. Office. InterOP. owc11.xlhalign. xlhaligncenter );
// Set the font size
Xlsheet. get_range (xlsheet. cells [1, 1], xlsheet. cells [1, 14]). Font. set_size (14 );
// Set the column width
Xlsheet. get_range (xlsheet. cells [1, 3], xlsheet. cells [1, 3]). set_columnwidth (50 );
// Draw a border line
Xlsheet. get_range (xlsheet. cells [1, 1], xlsheet. cells [10, 15]). Borders. set_linestyle (Microsoft. Office. InterOP. owc11.xllinestyle. xlcontinuous );
// Write data (this can be generated by DS as needed)
For (int row = 2; row <10; row ++) // note that when writing data, you must write data from the first row without row "0" in Excel.
{
For (INT I = 0; I <15; I ++)
{
Xlsheet. activesheet. cells [row, I + 1] = 123.456;
}
}
Try
{
String saveexefilename = textbox1.text;
// Format the number as the amount (the value in the cell to be formatted must be numeric)
Xlsheet. get_range (xlsheet. cells [2, 1], xlsheet. cells [10, 15]). set_numberformat ("¥ #, #0.00 ");
Xlsheet. Export (saveexefilename, Microsoft. Office. InterOP. owc11.sheetexportactionenum. ssexportactionnone, Microsoft. Office. InterOP. owc11.sheetexportformat. ssexportxmlspreadsheet );
Textbox2.text = "system output successful ";
}
Catch
{
}
}
}
}
Source from reference http://dev.csdn.net/article/74/74867.shtm
Steps for using the owc component in Asp.net and installing the owc component