 |
|
 |
Hi, I have a problem. I am trying to read a xls file. On my local machine everything works fine, but when i test it on a server i get this error "An item with the same key has already been added" on this line "book.Open(fileStream);"
I hope someone can help me, and sorry for my bad english :$ Here is the Stack Trace:
[ArgumentException: An item with the same key has already been added.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +51 System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +2628449 System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +11 QiHe.Office.Excel.MsofbtDgg.Decode() in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Extended\MsofbtDgg.cs:25 QiHe.Office.Excel.MsofbtContainer.Decode() in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Extended\MsofbtContainer.cs:19 QiHe.Office.Excel.MSOCONTAINER.Decode() in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Extended\MSOCONTAINER.cs:19 QiHe.Office.Excel.Workbook.DecodeRecords() in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Workbook.cs:103 QiHe.Office.Excel.Workbook.Read(Stream stream) in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Workbook.cs:43 QiHe.Office.Excel.Workbook.Open(Stream file) in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ExcelReader\Office\Excel\Workbook.cs:37 System.Harweb.Utilidades.ClsFiles.GetExcelData(String filePath, String tableName) in C:\DDisk\Harweb.net HWD\Dynamic Linked Libraries\Generales\System.Harweb.Utilidades\System.Harweb.Utilidades\ClassFiles.cs:96 perfilxls.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\Harweb_SESA\harweb\1131\mov\movlab\dinamico\cargar\perfilxls.aspx.cs:78 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I have read in an existing spreadsheet and need to insert a column in postion 0 (first column).
Is there anyway to do this?
The method i tried just overwrites the read in data.
Thanks
Scott.
modified on Tuesday, August 25, 2009 9:58 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I couldnt find a way to do it so added this method to the row class:
public void InsertColumn(int colIndex, Cell cell) { for(int i=LastColIndex; i >= colIndex; i--) { Cell tempCel = GetCell(i); SetCell(i + 1, tempCel); } SetCell(colIndex, cell); }
Feel free to include this in the next release as i think its a needed feature.
Thanks
Scott
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi this is a great project, nice job Liu but I have a little problem, when I modify a file and when I save it I lost all the formulas present in the file and in the cells where there were the formulas I found only the value, this is the code that I use: Workbook book = Workbook.Open(txtSource.Text); Worksheet sheet = book.Worksheets[0]; sheet.Cells[0, 0] = new Cell("Test"); book.Save(txtDestinazione.Text);
I wrong something or anything else? Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The code works as rewritting the whole file. Formatting styles, formulas and other unsupported features are not preserved.
I am happy to work with people doing great projects.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Liu
Nice work on the library, I was wondering how do you create a hyperlink to a relative path in a cell.
Cheers Mick
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Huh?? This libray does not use interop, ergo Excel is not required to be installed on the client machine.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Could anyone give me a little code-sample on how to get the markup for a cell (fonts, border, color etc).
I'm trying to get it running in ASP.NET (C#), but I cannot seem to get it right.
Thanks in advance, K. van der Werf
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Exception of type 'System.OutOfMemoryException' was thrown.
at
this.MasterSectorAllocationTable = new List<int>(NumberOfSecIDs);
The number of sector IDs is 1836592733. Is that to big for an int?
Michael S. Flynn
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am writing an extra row to an existing Excle spreadsheet and after writing the file I try to reopen the file and receive an error: EndOfStreamException was unhandeld Unable to read beyond te end of the stream;
When I open the file in Excel and save it with Excel I am able to open it with my program again.
Any idea why this is happening?
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Hello,
first thanks for a nice project.
What would be the easiest way to directly encode a Workbook object to the Output-stream of a Html webpage Response object without needing to first save the information to file.
E.g. The user uploads an Excel file with some information that is processed and added to by the server which than should return the information to the user by letting them decide where to save the new/modified file.
Any idea about the best/easiest way to accomplish this?
Best regards, Henrik
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Implemented by r47. You can use Workbook's Save(Stream stream) method.
I am happy to work with people doing great projects.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am able to generate the excel with my Webpage using the following codes. The file download dialog will be shown and user can save the file on desktop.
When I open the file, it displays this message "Lost document summary information.". But the file appear correct as it contains all data and worksheets. Any idea what could be the reason? Being trying all ContentType, Response method, but none seems to be able to remove that error message.
Thanks.
Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=excelfile1.xls"); WorkbookEncoder.Encode(workbook, Response.OutputStream); Response.End();
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, not sure if this is the best method I should be using. I overload the 2 methods in your project to pass in MemoryStream and I am able to export excel with ease from my ASPX.
public static CompoundDocument Create(MemoryStream stream) - CompountDocument.cs public MemoryStream SaveStream(MemoryStream streamInput) - Workbook.cs
Codes use in my ASPX page to generate the excel file on the fly. Response.Clear(); Response.ContentType = "application/ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=XLSFormat.xls"); MemoryStream streamOutput = new MemoryStream(); MemoryStream streamInput = new MemoryStream(); streamOutput = workbook.SaveStream(streamInput); Response.OutputStream.Write(streamOutput.ToArray(), 0, streamOutput.ToArray().Length); Response.Flush(); Response.Close(); Response.End();
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Document summary information is not encoded to the generated file. So the message "Lost document summary information." is right about this. But it depends on the Viewer/Editor to show this message or not. Of course we should better support encoding Document summary information.
I am happy to work with people doing great projects.
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
 |
Hi, really great job, tnx. In my program I read Excel by one row at a time. How can I know when I reached the last row ?
Respectfully, Exceter.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
int row = 0; int col = 0; while (sheet.Cells[row, col].StringValue != "") { lv.Items.Add(sheet.Cells[row, col].StringValue); col++; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
I noticed all my dates are coming out with an extra day added onto them, ie: 01-Apr-2008 became 02-Apr-2008.
I found this code in SharedResource.cs I was unsure about...
public double EncodeDateTime(DateTime value) { double days = (value - BaseDate).Days; if (days > 365) days++; return days; }
Why does an extra day get added on if the number of days is greater than 365? I thought it might have something to do with the 1900 leap year and base dates being 31-Dec-1899, but the value of BaseDate when run through in code is actually 01-Jan-1904 which means there doesn't need to be an extra day added for the leap year anyway?
Can anyone help?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Will your library work with Excel documents saved in Excel 2007 Format? I have a code sample that reads through and prints the contents of an Excel 2003 file and that works just fine. Then I tried the same code to read an Excel 2007 file (.xlsx file) and I get an OutOfMemoryException when trying to Open the file via Workbook.Open(filename) call.
I'm trying this in a VS2008 solution.
Thanks, Beth
|
| Sign In·View Thread·PermaLink | 2.83/5 (4 votes) |
|
|
|
 |
|
|
 |