|
CompoundDocument keeps a reference to the underlying FileStream (CompountDocument.FileStorage) as a field and doesn't properly close it in case of error during reading.
To fix this CompountDocument should implement IDisopsable, call FileStorage.Close() within it's IDisposable.Dispose() method, and all places where a CompountDocument are created should be wrapped in a using() call.
Thanks,
Sam
|
|
|
|
|
Thanks for your suggest. Code submitted as r50 and r51. http://code.google.com/p/excellibrary/source/list
I am happy to work with people doing great projects.
|
|
|
|
|
|
it saved my day thankyou Liu
|
|
|
|
|
|
Hi!
Gotta say that this is a very good component, and saved me from depending on Microsoft Excel for file reading.
I was trying to figure out your code, but my lack of time (and experience with Excel files at your knowledge level) didn't let me to find a way to tell the Workbook.open method just to read only worksheet names at first instance and then just the data of that worksheet.
I have a problem viewing some Excel files because they have graphics or something embeded, but I only need to get to the worksheets that contains chewable data, but it seems that when I open the Excelbook it reads all first.
I hope you can give me a light to solve this problem.
Thanks a lot.
|
|
|
|
|
|
Hi Junfeng Liu,
Your effort to make this library is very appreciable.
That's really very useful. I want to get forecolor of a cell. It can give backcolor, but how can I know what is forecolor of a cell? please help me because that's very important for me!
Thanks a lot!
|
|
|
|
|
|
Great work,I have used in my WCF project
|
|
|
|
|
I need a function that writes a excel in a byte array instead of write in file. What i need change, i'm a noob and i don't unsderstand the process that's write the file if someone can help me?
|
|
|
|
|
Not sure what is the deal with Excel 2010 but if I try and open a xls created with this code excel throws and error when you try to open the file saying, "Excel found unreadable content in 'Newexcel.xls'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes".
It does not matter what you click, it never opens the file. I don't have any issues in 2007 or earlier versions of excel. Is there a workaround that anyone could share?
for reference here is the test code I am using to create the xls:
Workbook book2 = new Workbook();
Worksheet sheet1 = new Worksheet("Test1111");
sheet1.Cells[0, 1] = new Cell("this");
sheet1.Cells.ColumnWidth[0, 1] = 3000;
book2.Worksheets.Add(sheet1);
book2.Save("c:\\temp\\Newexcel.xls");
|
|
|
|
|
I have same issue also, anyone can help?
|
|
|
|
|
With Excel 2007 there was a problem opening a file when the result file size was under 7kb, so when creating a file from a dataset I have added some dummy rows when the data amount was too small, something like this
' Add dummy rows to the existing dataset
For i As Integer = 1 To 20
Dim newDummyRow As DataRow = ds.Tables(0).NewRow()
newDummyRow(0) = " "
ds.Tables(0).Rows.Add(newDummyRow)
Next i
' Create a file from dataset
ExcelLibrary.DataSetHelper.CreateWorkbook(strFilename, ds)
|
|
|
|
|
I also faced problem. This helped. Thanks a lot
|
|
|
|
|
When print previewing or printing the generated excel file, I got this error message,
"Microsoft Office Excel did not find anything to print."
Any idea what the problem is?
|
|
|
|
|
How does one merge cells using this library?
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
|
Huh?? This libray does not use interop, ergo Excel is not required to be installed on the client machine.
|
|
|
|