<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'excel'</title><link>http://forums.asp.net/search/SearchResults.aspx?q=&amp;tag=excel&amp;orTags=0&amp;o=DateDescending</link><description>Search results matching tag 'excel'</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Import Excel data into SQL db</title><link>http://forums.asp.net/thread/3574264.aspx</link><pubDate>Sat, 19 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3574264</guid><dc:creator>SergeKor</dc:creator><description>&lt;p&gt;You can see a good description of&amp;nbsp;&lt;a href="http://inventory-system.blogspot.com/2009/12/import-data-from-excel-file-in-aspnet.html"&gt;importing Excel files here&lt;/a&gt; &lt;/p&gt;</description></item><item><title>How to create Excel Cross Tab Report</title><link>http://forums.asp.net/thread/3573048.aspx</link><pubDate>Fri, 18 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3573048</guid><dc:creator>shak</dc:creator><description>&lt;p&gt;Hello everyone, I am wandering that how can I create Cross-Tab Report with DataSets and display the data in Microsoft Excel with C#? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>'Filename.xls' cannot be accessed. When downloading from Server</title><link>http://forums.asp.net/thread/3570925.aspx</link><pubDate>Thu, 17 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3570925</guid><dc:creator>stephen.adshead</dc:creator><description>&lt;p&gt;&amp;#39;Filename.xls&amp;#39; cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server&amp;nbsp;the document is stored on may not be responding.&lt;/p&gt;
&lt;p&gt;I have&amp;nbsp;several Excel files which my end users&amp;nbsp;can download from my ASP.net app however this has suddenly stopped working on all the Excel Spreadsheets, when you try and open the file you get the error above.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is this something that has been changed in the web.config? I have been googling the error but all posts refer to spreadsheet corruption... they cant all have become currupt surely?&lt;/p&gt;
&lt;p&gt;Thanks in advance &lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;</description></item><item><title>External table is not in the expected format.</title><link>http://forums.asp.net/thread/3571051.aspx</link><pubDate>Thu, 17 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3571051</guid><dc:creator>pritam.ahire</dc:creator><description>&lt;p&gt;i have developed 2 applications in asp.net&amp;nbsp; which wil b use by 2 persons at diff location .,,,in my first application at the end user genrate excel sheet from gridview which he/she send to second person via mail &lt;br /&gt;&lt;/p&gt;&lt;p&gt;the second person receives tht mail and he/she upload tht excel file but while uploading tht excel file i am getting following error&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;External table is not in the expected format. &lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;after some trial/error method i found tht if i am Re-Saving&amp;nbsp; tht file with some another name&lt;br /&gt;&lt;/p&gt;&lt;p&gt;then tht excel file is successfully uploaded ,,i dont knw whts prob &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description></item><item><title>Re: Help me on how to Export datagrid data to Excel?</title><link>http://forums.asp.net/thread/3553440.aspx</link><pubDate>Tue, 08 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3553440</guid><dc:creator>waqas_w</dc:creator><description>&lt;pre class="c-sharp" name="code"&gt;public static void ConvertDstoExcel(DataSet ds ,HttpResponse response)
    {
    
        response.Clear();
        response.Charset = &amp;quot;&amp;quot;;
    
        response.ContentType = &amp;quot;application/vnd.ms-excel&amp;quot;;
    
        StringWriter stringWrite = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        
        DataGrid dg = new DataGrid();
        dg.DataSource = ds.Tables[0];
        dg.DataBind();
    
        dg.RenderControl(htmlWrite);
    
        response.Write(stringWrite.ToString());
        response.End();
    }&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;hope its helpfull&lt;/p&gt;</description></item><item><title>Generate excel using xml</title><link>http://forums.asp.net/thread/3545677.aspx</link><pubDate>Thu, 03 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3545677</guid><dc:creator>visitmohanraj</dc:creator><description>Hi all 

              i want to genrate an excel file using  xml.currently i have a string variable which holds xml structure i want to know how can i generate an excel file using xml structre in string variable ?? i have used xmldocument.load( variable) but this give me an error i have attached the code and error for reference??
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
using System.Xml;
using System.IO;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strExcelXml = string.Empty;

            
            //Excel.Application xlApp;
            //Excel.Workbook xlWorkBook;
            //Excel.Worksheet xlWorkSheet;
            //object misValue = System.Reflection.Missing.Value;

            //xlApp = new Excel.ApplicationClass();
            //xlWorkBook = xlApp.Workbooks.Add(misValue);

            //xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            //xlWorkSheet.Cells[1, 1] = &amp;quot;http://csharp.net-informations.com&amp;quot;;

            //xlWorkBook.SaveAs(&amp;quot;csharp-Excel.xls&amp;quot;, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
            //xlWorkBook.Close(true, misValue, misValue);
            //xlApp.Quit();
            //releaseObject(xlWorkSheet);
            //releaseObject(xlWorkBook);
            //releaseObject(xlApp);

            //MessageBox.Show(&amp;quot;Excel file created , you can find the file c:\\csharp-Excel.xls&amp;quot;);

            strExcelXml += (ExcelHeader());
            
            // Create First Worksheet
            strExcelXml += (WriteFirstWorkSheet());
            // Worksheet options Required only one time 
            strExcelXml += (ExcelWorkSheetOptions());

            for (int i = 1; i &amp;quot;);
                // Then Table Tag
               strExcelXml += (&amp;quot;&lt;table&gt;&amp;quot;);
                for (int k = 1; k &lt;tr&gt;&amp;quot;);
                    for (int j = 1; j &lt;td&gt;&amp;quot;);
                        strExcelXml += (
                          &amp;quot;Sheet&amp;quot; + i.ToString() + &amp;quot;Row&amp;quot; + k.ToString() + &amp;quot;Col&amp;quot; + j.ToString());
                        strExcelXml += (&amp;quot;&lt;/td&gt;&amp;quot;);
                    }
                    strExcelXml += (&amp;quot;&lt;/tr&gt;&amp;quot;);
                }
               strExcelXml += (&amp;quot;&lt;/table&gt;&amp;quot;);
                strExcelXml += (&amp;quot;&amp;quot;);
            }
            // Close the Workbook tag (in Excel header 
            // you can see the Workbook tag)
            strExcelXml += (&amp;quot;\n&amp;quot;);
            XmlDocument empDoc = new XmlDocument();
            // Response.ContentType = &amp;quot;text/xml&amp;quot;;

            //Load the XML from a String
            empDoc.LoadXml(strExcelXml);
            //Save the XML data onto a file                    
            empDoc.Save(&amp;quot;D:\\EmployeesNew.xml&amp;quot;);
              //  Response.Write(empDoc.InnerXml);
           
            }
 private string ExcelHeader()
        {
            // Excel header
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(&amp;quot;\n&amp;quot;);
            sb.Append(&amp;quot;\n&amp;quot;);
            sb.Append(
              &amp;quot;\n&amp;quot;);
            sb.Append(
              &amp;quot;&amp;quot;);
            sb.Append(&amp;quot;&amp;quot;);
            sb.Append(
              &amp;quot;\n&amp;quot;);
            sb.Append(&amp;quot;False\n&amp;quot;);
            sb.Append(&amp;quot;False\n&amp;quot;);
            sb.Append(&amp;quot;\n&amp;quot;);
            return sb.ToString();
        }
        private string WriteFirstWorkSheet()
        {
            //These tags can be generated by jsut creating an test Excel and Save As &amp;quot;Spreadsheet XML&amp;quot;
            string strFirstWorkSheet = string.Empty;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            //	sb+=&amp;quot;&amp;quot;;
            string strNewLine = &amp;quot;\n&amp;quot;;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&lt;table&gt;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            // Merge Cells
            strFirstWorkSheet += &amp;quot;Column Merged&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            // Bold
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;Bold&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            //Italics
            strFirstWorkSheet += &amp;quot;Italics&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            //Hyperlink
            strFirstWorkSheet += &amp;quot;Hyperlink&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            //Row Height
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;Row Height&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;
            // Close Tags
            strFirstWorkSheet += &amp;quot;&lt;/table&gt;&amp;quot; + strNewLine;
            strFirstWorkSheet += &amp;quot;&amp;quot; + strNewLine;

            return strFirstWorkSheet;
        }
        private string ExcelWorkSheetOptions()
        {
            // This is Required Only Once ,	But this has to go after the First Worksheet&amp;#39;s First Table		
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(&amp;quot;\n\n\n \n&amp;quot;);
            return sb.ToString();
        }

Error which I am getting when using load document method is:&amp;quot;The generated excel cannot be viewed&amp;quot;
i get the xml structure in strExcelXml variale and the xml structure is:






False
False


&lt;table&gt;


Column Merged


Bold


Italics


Hyperlink


Row Height

&lt;/table&gt;




 
&lt;table&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row1Col1&lt;/td&gt;&lt;td&gt;Sheet1Row1Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row2Col1&lt;/td&gt;&lt;td&gt;Sheet1Row2Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row3Col1&lt;/td&gt;&lt;td&gt;Sheet1Row3Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row4Col1&lt;/td&gt;&lt;td&gt;Sheet1Row4Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row5Col1&lt;/td&gt;&lt;td&gt;Sheet1Row5Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row6Col1&lt;/td&gt;&lt;td&gt;Sheet1Row6Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row7Col1&lt;/td&gt;&lt;td&gt;Sheet1Row7Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row8Col1&lt;/td&gt;&lt;td&gt;Sheet1Row8Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row9Col1&lt;/td&gt;&lt;td&gt;Sheet1Row9Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row10Col1&lt;/td&gt;&lt;td&gt;Sheet1Row10Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row11Col1&lt;/td&gt;&lt;td&gt;Sheet1Row11Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row12Col1&lt;/td&gt;&lt;td&gt;Sheet1Row12Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row13Col1&lt;/td&gt;&lt;td&gt;Sheet1Row13Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row14Col1&lt;/td&gt;&lt;td&gt;Sheet1Row14Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row15Col1&lt;/td&gt;&lt;td&gt;Sheet1Row15Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row16Col1&lt;/td&gt;&lt;td&gt;Sheet1Row16Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row17Col1&lt;/td&gt;&lt;td&gt;Sheet1Row17Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row18Col1&lt;/td&gt;&lt;td&gt;Sheet1Row18Col2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sheet1Row19Col1&lt;/td&gt;&lt;td&gt;Sheet1Row19Col2&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;



so how do i do it  and whats wrong in this???
</description></item><item><title>Dynamically generate EXCEL file</title><link>http://forums.asp.net/thread/3539425.aspx</link><pubDate>Mon, 30 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3539425</guid><dc:creator>sharadc</dc:creator><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;My requirement is kind of export to excel funtionality from a search page, where the number of columns and rows will be decided on the creteria selected by user. But the basic design of the excel is fixed..... so I was thinking if it is possible to have ready template where all the formatting thing can be predefined and at runtime I can just repeat the rows and coulmn with their respective cell values (If possible would like to add formulas also).&lt;/p&gt;
&lt;p&gt;The data has to be pulled from the database so I guess there is no luxury for me to generate excel direcly from DataGrid. But&amp;nbsp;I am ready to try options using HTML/Data Grid/XML/EXCEL (If possible any other option without using Office library because it has lot of dependency on version etc.)&lt;/p&gt;
&lt;p&gt;Since the excel will be dynamically generated, immediate reponse is expected. &lt;/p&gt;
&lt;p&gt;Looking for your valuable suggestions...&lt;/p&gt;</description></item><item><title>Re: need help: Export large data from table to excel</title><link>http://forums.asp.net/thread/3536540.aspx</link><pubDate>Fri, 27 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3536540</guid><dc:creator>pritam.ahire</dc:creator><description>&lt;p&gt;yes u can do this i guess you want to genrate excel sheet from ur table which is stored into ur database &lt;/p&gt;
&lt;p&gt;do one thing on drag gridview and button onto page nd on page load event bind ur table to gridview then&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;on clicking of tht button write following code it will genrate excel sheet for u&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;using System.IO; namespace&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;string attachment = &amp;quot;attachment; filename=GridViewExport.xls&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Response.ClearContent();&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Response.AddHeader(&amp;quot;content-disposition&amp;quot;, attachment);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt; Response.ContentType = &amp;quot;application/ms-excel&amp;quot;;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;StringWriter sWriter = new StringWriter();&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;HtmlTextWriter htwWriter = new HtmlTextWriter(sWriter);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;GridView1.RenderControl(htwWriter);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Response.Write(sWriter.ToString());&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Response.End();&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>.net application with excel 2007</title><link>http://forums.asp.net/thread/3526896.aspx</link><pubDate>Sun, 22 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3526896</guid><dc:creator>adityaraj</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I have written an applicantion using asp.net that updates the cells of an excel page using interop services and then save that workbook later read all the computed data from that same workbook using oledb dataapadter.&lt;/p&gt;&lt;p&gt;Now my question is in development environment i have excel 2007 installed.But,in server we have excel 2003,so i would like to know will there be any consequenses beacuse of that.&lt;/p&gt;&lt;p&gt;Or it is must and should i have to use excel 2007 liscence in server also?Please suggest.Very urgent!!!!!!!!!!!!!!!!&lt;br /&gt;&lt;/p&gt;</description></item><item><title>unable to read date values from excel</title><link>http://forums.asp.net/thread/3518919.aspx</link><pubDate>Wed, 18 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3518919</guid><dc:creator>anandjk1</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have&amp;nbsp;used the code&amp;nbsp;given&amp;nbsp;in the below link to read data from excel file and display it on gridview.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspfree.com/c/a/ASP.NET-Code/Read-Excel-files-from-ASPNET/"&gt;http://www.aspfree.com/c/a/ASP.NET-Code/Read-Excel-files-from-ASPNET/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The code runs fine but the &amp;#39;date&amp;#39; values(format type is date)&amp;nbsp;&amp;nbsp;present in the excel file are not read. Please suggest if have to do any additional changes.&lt;/p&gt;
&lt;p&gt;Thanks in Advance&lt;/p&gt;
&lt;p&gt;-Anand&lt;/p&gt;</description></item></channel></rss>