.Exporting data from Dataset to Excel sheet in VB.net Windows Application & vice ver
How to Export data from Dataset to Excel sheet in VB.net Windows Application
and also How to convert Excel Sheets into Data set Using VB.net coding(Windows Application)
how to Convert Dataset into XL Sheet to the VB.net Windows Application only by using the default resource(dll) available in VB.net.
ie without need to add Office Primary Interop Assemblies of the Microsoft Excel 2003 or without the need for installing the Microsoft Office.
We are developing a Product using VB.net (Windows Application). After Developing the Product , we need to install it in different Location which may or may not have Microsoft office.
So is it possible to write coding in VB.net to convert a data set into Excel sheet & vice versa by using the Normal features of VB.net instead of the need to Install Microsoft Office in the Client System adding reference to PIA*in the VB.net Application
The Below are some method/ideas by which data set con be converted into Excel Sheet but it is not suitable for our company.
so we are searching
for another Idea / Method which does not require the installation of Microsoft Office
One way is to Office Primary Interop Assemblies in the Microsoft Excel 2003.
1) By adding .net Programmability Support to the Microsoft Excel 2003.
2) When you want to use the Excel 2003 PIAs in a .NET-based application, add a reference to them in the Add Reference dialog box of Visual Studio .NET.
3) Once you add this reference, you can manipulate the Excel COM objects as though they were native .NET-based assemblies.
4) VB.net Coding can be Used to Convert the Dataset into XL Sheets.
few other methods are
The easiest way to export the data
would be to do it to either tab or comma delimited file. Excel and other spreadsheets are able to read comma delimited files. Alternatively, would be to use an xsl template and export the data out as a xml file.
Look under System.Xml for various functions you could use.
Here's a sample using C# code, but the class and function names are the same for VB.Net
DataSet ds; // dataset you want to export out to the file
XmlDataDocument xmlDoc = new System.Xml.XmlDataDocument(ds);
XslCompiledTransform xslTran = new System.Xml.Xsl.XslCompiledTransform();
//Create XmlTextWriter for the FileSteam
FileStream fs = new System.IO.FileStream(xmlFile, System.IO.FileMode.Create);
XmlTextWriter xtw = new System.Xml.XmlTextWriter(fs,System.Text.Encoding.Unicode);
//Add processing instructions to the beginning of the XML file,
// one of which indicates a style sheet.
strXSLFilename = "test.xsl";
xtw.WriteProcessingInstruction("xml-stylesheet","type='text/xsl' href='" + xslRef + "'");
//Write the XML from the dataset to the file
I noticed that after posting
Oh well! Maybe somebody else can use the info.