 |
|
 |
first : thanks for useful method.
i have a datagridview in a from and i want to export the data of this datagridview to excel file ,
in this method,the input argument is DATASET and i want to change datagridbiew content to dataset to using ur method,how can i do that?
best regards.
|
|
|
|
 |
|
 |
what is the data grid view bound to?
|
|
|
|
 |
|
 |
Hi,
if datagridview is bound to DataTable then you can easily export it to Excel with GemBox.Spreadsheet .NET Excel library.
For details see:
|
|
|
|
 |
|
 |
Thanks for the code. It solves a lot of issues. I have one problem but it thinks it's an excel problem. When I try and open the files, after running the code, I get errors due to some of the year values being less than 1900.
Any ideas?
Thanks!
jeff
|
|
|
|
 |
|
 |
I have a temporary fix for this issue. If the date is less than 1900, I treat it as a string.
|
|
|
|
 |
|
 |
Do you mean that you face a problem when you put a year less then 1900, or you are just inserting time and you see 1900 is calculated with it automatically.
can you please give more details so we can help you about it.
|
|
|
|
 |
|
 |
Friends,
I'm having problem to export a DataSet using XML, because the client's Office is Version 2000.
When the file .xls is opened, only is show some tags of XML and don't show datas of DataSet.
How can I solve this problem?
Hugs,
Reginaldo Pereira
|
|
|
|
 |
|
 |
Helow,
Please help me?
I don't know how to I solve this?
Reginaldo
|
|
|
|
 |
|
|
 |
|
 |
By the way XML format in excel is supported in
MS office 2000 SP3
MS Office XP SP3
MS office 2003
MS office 2007
|
|
|
|
 |
|
 |
hellow,
I would like to fill with color a cell. How to I do this? I tried "
Someone Can I help me? please
Hugs,
Reginaldo Pereira
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Use this method, we also can export gridview data which datasource is dataset to excel and save it in client side
-- modified at 1:38 Thursday 29th November, 2007
Better Coder, Better Life
|
|
|
|
 |
|
 |
Hi,
Is it possible to write the dataset into an existing xls on the system. Currently the method creates a new xls and writes the data there.
I've existing excek templates and would simply like to load the data in it.
Btw your code is really helpful!
Girish
|
|
|
|
 |
|
 |
This method has one serious drawback. If you try to use Ole Db to read data from the generated excel file you will get an exception because the file in reality is xml file, not native excel xsl file.
|
|
|
|
 |
|
 |
you're right. i think some earlier post shows how to do the export to excel using an oledb provider. if i need a native xsl file, i just open the exported xml and save as xsl.
|
|
|
|
 |
|
 |
Xodiak wrote: if i need a native xsl file, i just open the exported xml and save as xsl.
That can be done programmatically to like this:
private void savetoexcelformat(string currentpath, string pathtosave)
{
object missing = System.Reflection.Missing.Value;
Excel.Application app = new Excel.Application();
app.Visible = false;
app.Workbooks.OpenXML(currentpath, missing,missing).SaveAs(pathtosave, Excel.XlFileFormat.xlWorkbookNormal, missing, missing,
missing, missing, Excel.XlSaveAsAccessMode.xlNoChange, missing, missing, missing, missing, missing);
app.Quit();
}
|
|
|
|
 |
|
 |
Hello there. This is a very good code, indeed. It works just perfect, no problems yet.
More than that, i modified it a little bit. I put this code into a separate class, added support for selecting location and file name via a SaveFileDialog, and added also support for dynamic specify the table index to use. So you just make a class, and initiate function from any other form / class by calling it like "excelexport.ExportToExcel(int tblID)" and all is done by the other code. For anyone that needs it, call me hoinarut@yahoo.com
|
|
|
|
 |
|
 |
Very fast to export large amount of data, thanks
|
|
|
|
 |
|
 |
Hi, I would like to check whether can we group and outline a few columns in this example so that these columns will be hidden? I am able to hide some columns here. Code to hide columns:
Please help for the code to group a list of columns in this Excel/XML format.
Thanks.
|
|
|
|
 |
|
 |
just open excel, and apply any styles/colors that you would like to. save the excel as an xml document and look at the style definitions it generates. Hope thats what you were looking for.
|
|
|
|
 |
|
 |
You can use the DataGridView Extension for this purpose - it is not another control, just extends the basic control. You can export data and visualization to Excel, Html, search for text and so on ... see http://www.completit.com/Products/DGVE/Overview.aspx
Alexander Alexandrov
|
|
|
|
 |
|
 |
I need to export html tables into xls format in different sheets. There are four html table on web page. All convert into one xls file but in different sheets.
Mustakim Mansuri
|
|
|
|
 |
|
 |
study the code. It should be really easy to change it to get what you need to. here is the code for writing to different sheets (you're implementation will be slightly different). if(rowCount==64000) { rowCount = 0; sheetCount++; excelDoc.Write("</Table>"); excelDoc.Write(" </Worksheet>"); excelDoc.Write("<Worksheet ss:Name=\"Sheet" + sheetCount + "\">"); excelDoc.Write("<Table>"); }
so you'll probably have to do something where you iterate through the datatables and write them out. take a look at the xml file thats generated, it'll help you understand whats going on. there are a couple of threads that show how to iterate through multiple tables. good luck
|
|
|
|
 |