 |
|
 |
how can i write array of string in excel file based your code?
|
|
|
|
 |
|
|
 |
|
 |
Can you please include a sample source code file that demonstrates how to consume the ExcelFileWriter.
Thanks
|
|
|
|
 |
|
 |
This artical is very useful... Thanks
But I need to assign my list of Entity to the Two dimention array object. The entity contains various Properties like Name, Id, Age, MobileNum etc.
And this Entity will dynamic also so list will be of different different entities.
Is there any way to access the List[0].Properties name using index so that it can be assigned directly to the 2D array.
Instead of
myexceldata[Row, Col]= list[Row - 1].PropertyName // PropertyName cannot be hard coded as per my requirement.
Looking forward to your reply
Thanks in advance.
modified on Monday, July 12, 2010 7:07 AM
|
|
|
|
 |
|
 |
I ald have my excel file. I want to add data. But I always receive prompt that do i want to overwrite?
How should i do not to receive this error and force overwrite?
|
|
|
|
 |
|
 |
Hey,
Just want to let you know that you helped me out a lot with your code. Thank you for posting this.
Ryan
|
|
|
|
 |
|
 |
For exporting data I am using following code:
string attachment = "attachment; filename=Contacts.pdf";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/pdf";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
grdvDisplay.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
But when I want to open exported file, the error message is displayed:
"Acrobat could not open 'Contacts[1].pdf' because it is either not a supported file type or because the file has been damaged (for example, it was as an email attachment and wasn't correctly decoded)
To create an adobe PDF document, go to the source application. Then print the document to Adobe PDF."
Have any solution...???
Md. Atiqur Rahman
Software Developer
Spectrum Engineering Consortium Ltd.
|
|
|
|
 |
|
 |
There seems to be a common misconception that simply putting something like Response.ContentType = "application/pdf" will magically transform the response to whatever it is you want. I see similar code for Excel spreadsheet output. The reason why it "works" for Excel is that Excel will open the XLS file, see that it's really not an XLS file but an HTML file and do the conversion.
Adobe Acrobat will not do that so it will open the PDF file and find a load of HTML it doesn't understand. The HtmlTextWriter does exactly what it says... takes the control (GridView) and outputs the HTML that would otherwise be rendered to your web page. All you are doing is sending HTML to the browser but fooling it into thinking you are actually sending a PDF file, which you are not.
Hope that's not too discouraging, but that's why you are getting the error. If you want to do real HTML to PDF conversion then have a look at something like iTextsharp (http://itextsharp.sourceforge.net/[^]).
|
|
|
|
 |
|
|
 |
|
 |
i am new in csharp, maybe my question is too simple for expert...
for examples i have list of animal in excel file(animal.xls) [examples: "cow", "tiger","cat","duck"]
my question is: how can i get "cat" from excel file and generate as output in csharp(c#).
can anyone show me the simple coding
|
|
|
|
 |
|
 |
In my machine I use .Net Framework 2.0 and Visual Studio 2005. When I use this source code,
1. then error message is displayed 'The type of namespace name "Excel" could not be found (are you missing a using directive or an assembly reference?)'
2. In the references of solution explorer missing and show warning sign on Excel, Microsoft.Office.core, VBIDE
What can I do now?? How can the source code can work??
Md. Atiqur Rahman
Software Developer
Spectrum Engineering Consortium Ltd.
|
|
|
|
 |
|
 |
I had the same issue here and got around it by:-
using Excel = Microsoft.Office.Interop.Excel;
|
|
|
|
 |
|
 |
I am getting exceptions when the number of rows are greater then 65000 in sheet, else it's working fine. also i need to disply columns dynamically, in that case i've set the column range from A1 to Z1, now if there are 5 columns to be displayed then it displays #N/A# in the remaining columns. Is there any way to add more sheets if records are greater?
M Imran Niaz
LMKR
|
|
|
|
 |
|
 |
Hi
How to add ExcelFileWriter.cs in my project , should i need to use "using" key work but on using this it gives error, help me out
regard
flamingo
|
|
|
|
 |
|
 |
i am not able to get the .zip file. it is corrupted.
monali
|
|
|
|
 |
|
 |
i downloaded that zip and tried to run its shows the error that WriteToExcel.csproj is not installed
in that zip itself that file is not there
Saravana Kumar B
|
|
|
|
 |
|
 |
i tried to compile this project on my machine but it doesnt work. I have tried added all the appropriate com references to excel5.0 and i have also tried excel 12. it keeps giving me errors like:
Error 2 Cannot create an instance of the abstract class or interface 'Excel.Application' C:\Users\me\Desktop\WriteToExcel\WriteToExcel\WriteToExcel\ExcelFileWriter.cs 77 33 WriteToExcel
Error 4 Cannot convert method group 'Worksheets' to non-delegate type 'Excel.Sheets'. Did you intend to invoke the method? C:\Users\me\Desktop\WriteToExcel\WriteToExcel\WriteToExcel\ExcelFileWriter.cs 80 28 WriteToExcel
whats up with it, or with my machine?
|
|
|
|
 |
|
 |
This can't be considered production ready code without the cleanup of the unmanaged resources.
|
|
|
|
 |
|
 |
I am pretty sure that no one will simply take the class written by someone and directly use it in the production code. btw which unmanaged resource we have to clean up.
|
|
|
|
 |
|
 |
using Microsoft.Office.Interop.Excel;
public class ExcelHelper
{
private ApplicationClass _app;
private Workbooks _wbs;
private Workbook _wb;
private Worksheet _ws;
private Range _range;
}
All the above are examples of unmanaged resources which needed to be cleaned up. There are alot of good online resources which show how to properly clean up when using excel interop. One of them I found useful is: http://www.xtremevbtalk.com/showthread.php?t=160433
Hope this helps.
- Jay
|
|
|
|
 |
|
 |
Does you api let me introduce formulae in the cells?
In the way excel does: A1 = B1 + C1
Or do i have to manage that in c# code and just write the result?
Could I insert an excel graph?
I'm searching for a library that offers me that (or maybe i'll have to work directly with excel object)
Thanks in advance.
|
|
|
|
 |