asp.net
Fp2003\owc11. Msi
Reference
Microsoft Office Web Components 11.0
C:\Program Files\Common files\microsoft Shared\Web Components\11\owc11. Dll
installation files OFFICE2003 installation CD \fp2003\owc11. Msi
OFFICE2003 Install CD \office11\owc11. Msi
The default installation is complete OFFICE2003 now do not know if there is, after installation in the STUDIO2005 system can find this component
However, this component is still not available in ASP
' Check to see if the component is supported and the assembly version of the subroutine
Sub Objtest (strobj)
On Error Resume Next
Isobj=false
Verobj= ""
Set Testobj=server. CreateObject (Strobj)
If-2147221005 <> ERR Then ' thanks to netizens Iamfisher's 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 Button1_Click (object sender, EventArgs e)
{
Microsoft.Office.Interop.Owc11.SpreadsheetClass xlsheet =new Microsoft.Office.Interop.Owc11.SpreadsheetClass ();
Merging cells
Xlsheet.get_range (Xlsheet. Cells[1, 1], xlsheet. Cells[1]). Set_mergecells (True);
Xlsheet. Activesheet.cells[1, 1] = "First-level accounting table";
Font Bold
Xlsheet.get_range (Xlsheet. Cells[1, 1], xlsheet. Cells[1, 14]). Font.set_bold (TRUE);
Aligns cell text horizontally in the center
Xlsheet.get_range (Xlsheet. Cells[1, 1], xlsheet. Cells[1]). Set_horizontalalignment (Microsoft.Office.Interop.Owc11.XlHAlign.xlHAlignCenter);
Set Font size
Xlsheet.get_range (Xlsheet. Cells[1, 1], xlsheet. Cells[1, 14]). Font.set_size (14);
Set column width
Xlsheet.get_range (Xlsheet. Cells[1, 3], xlsheet. Cells[1, 3]). Set_columnwidth (50);
Draw Border Lines
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 as needed by the DS)
for (int row = 2; row < row++)//Note When you write data, you must start with the first line. There is no "0" line in Excel
{
for (int i = 0; i < i++)
{
Xlsheet. Activesheet.cells[row, i + 1] = 123.456;
}
}
Try
{
string saveexefilename = TextBox1.Text;
Format a number as an amount (the value in the cell you want to format must be numeric)
Xlsheet.get_range (Xlsheet. Cells[2, 1], xlsheet. CELLS[10]). Set_numberformat ("¥#,# #0.00");
Xlsheet. Export (Saveexefilename, Microsoft.Office.Interop.Owc11.SheetExportActionEnum.ssExportActionNone, Microsoft.Office.Interop.Owc11.SheetExportFormat.ssExportXMLSpreadsheet);
TextBox2.Text = "System Output Success";
}
Catch
{
}
}
}
}
Original from Reference http://dev.csdn.net/article/74/74867.shtm
asp.net using OWC component steps, OWC component installation