Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all 1877 articles
Browse latest View live

Edited Unassigned: Getting the Value for a Date Throws System.Format Exception [9356]

$
0
0
Getting the Value for a Date Cell thows a System.FormatException

Commented Unassigned: Getting the Value for a Date Throws System.Format Exception [9356]

$
0
0
Getting the Value for a Date Cell thows a System.FormatException
Comments: Sorry for posting -- issue has been resolved

New Post: Copying ranges with formulas using absolute references

$
0
0
Hi

I have a template file that is populated from my database. So I insert a new row for each record of my DB and in this new rows I need to copy the formulas of the previous rows, some of these formulas have absolute references for example

=IF($D$33,U10/(1-W10),0)

and I would expect that on the next row the copied formula should be

=IF($D$33,U11/(1-W11),0)

but instead I'm getting

=IF($D$32,U11/(1-W11),0)
=IF($D$31,U12/(1-W12),0)


My code looks somethin like this
int prevRowNo = currentRowNo - 1;
var prevRow = oSheet.Row(prevRowNo);
prevRow.InsertRowsBelow(1);
               
//var currentRange = oSheet.Range("A" + setIdx.ToString(), "AZ" + setIdx.ToString());     
var PrevRange = oSheet.Range("$A$" + prevRowNo.ToString() + ":$AZ$" + prevRowNo.ToString());
oSheet.Cell(CurrentRowNo, "A").Value = PrevRange;
I don't know if I'm doing something wrong,

Thanks

Created Unassigned: Excel found unreadable content when Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.0000" [9357]

$
0
0
Excel found unreadable content when Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.0000"

Milliseconds using Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.000" works fine.

7 decimal places would be nice B-)

This could be an Excel issue or other limitation beyond the scope of ClosedXML. But, you may want to trap for it to prevent generating an XLSX file that Excel does not like.

//AJ

PS: ClosedXML is GREAT WORK!!!

Closed Unassigned: Getting the Value for a Date Throws System.Format Exception [9356]

$
0
0
Getting the Value for a Date Cell thows a System.FormatException
Comments: Closing issue as Nlacoff indicated it was resolved.

New Post: Protect Workbook

$
0
0
I 'm waiting also for the workbook protection feature!
Thanks for your excellent work.

Created Unassigned: Lock Excel document for writing [9358]

$
0
0
Hi All,

is it possible to lock an excel document via the ClosedXML library.

I need to open the document and check it's content while modifying it via the ClosedXML functions cause this scenario throw an exception when trying to modify an opened document.

I need it urgently, so please give me a quick response.

Thanks

Edited Unassigned: Lock Excel document for writing [9358]

$
0
0
Hi All,

is it possible to lock an excel document via the ClosedXML library ?

I need to open the document and check it's content while modifying it via the ClosedXML functions cause this scenario throw an exception when trying to modify an opened document.

I need it urgently, so please give me a quick response.

Thanks

Closed Unassigned: Lock Excel document for writing [9358]

$
0
0
Hi All,

is it possible to lock an excel document via the ClosedXML library ?

I need to open the document and check it's content while modifying it via the ClosedXML functions cause this scenario throw an exception when trying to modify an opened document.

I need it urgently, so please give me a quick response.

Thanks
Comments: ClosedXML only locks the file while it reads or writes the file. If another app has a lock on the file then ClosedXML cannot read or write the file. If open a file then it will be locked only for the read moment, after that the file is fair game for other processes. If you save the file then it will be overwritten.

Closed Unassigned: Excel found unreadable content when Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.0000" [9357]

$
0
0
Excel found unreadable content when Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.0000"

Milliseconds using Style.NumberFormat.Format = "MM/dd/yyyy HH:mm:ss.000" works fine.

7 decimal places would be nice B-)

This could be an Excel issue or other limitation beyond the scope of ClosedXML. But, you may want to trap for it to prevent generating an XLSX file that Excel does not like.

//AJ

PS: ClosedXML is GREAT WORK!!!

Comments: That's not a valid Excel format. I don't think it's a good idea to trap formats because they can change from one Excel version to another.

New Post: Copying ranges with formulas using absolute references

$
0
0
I need an easy way to reproduce the problem. The following works:
var wb = new XLWorkbook();
var ws = wb.AddWorksheet("Sheet");

ws.Cell("A1").SetValue(1)
    .CellBelow().SetFormulaA1("A1 + $A$1")
    .CopyTo("A3");
A1 = 1
A2 = "A1 + $A$1"
A3 = "A2 + $A$1"

Source code checked in, #8fdfcaf0e22ae05ee8cf27c92d3b2d6ef753918a

$
0
0
Merge branch 'AdjustToContentsFix' of https://git01.codeplex.com/forks/nicknack2020/closedxml into NickNack2020/ClosedXml

Commented Unassigned: Lock Excel document for writing [9358]

$
0
0
Hi All,

is it possible to lock an excel document via the ClosedXML library ?

I need to open the document and check it's content while modifying it via the ClosedXML functions cause this scenario throw an exception when trying to modify an opened document.

I need it urgently, so please give me a quick response.

Thanks
Comments: Hi MDeLeon, Saving an excel file which is opened with Microsoft Excel causes an exception. Opening an excel file which is opened with Microsoft Excel causes also an exception. So file is not overwritten cause saving it causes an exception. So no way to modify and excel file with ClosedXML and opening it via Microsoft Excel at the same time ?

Commented Unassigned: Lock Excel document for writing [9358]

$
0
0
Hi All,

is it possible to lock an excel document via the ClosedXML library ?

I need to open the document and check it's content while modifying it via the ClosedXML functions cause this scenario throw an exception when trying to modify an opened document.

I need it urgently, so please give me a quick response.

Thanks
Comments: No way to modify the file with *anything* as long as Excel has a lock on the file.

Closed Unassigned: Multithreading- AdjustToContents not threadsafe [9348]

$
0
0
Hi,

I have recently upgraded from 0.65 to 0.73 and while I have seen some performance improvements, several reports that run in parallel threads crashed in my UAT environment. It seems the problem is in the AdjustToContents() method.

The full exception is:

---> System.InvalidOperationException: Object is currently in use elsewhere.
at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
at System.Drawing.Graphics.MeasureString(String text, Font font, Int32 width, StringFormat format)
at ClosedXML.Excel.FontBaseExtensions.GetWidth(IXLFontBase fontBase, String text, Dictionary`2 fontCache)
at ClosedXML.Excel.XLColumn.AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth, Double maxWidth)
at ClosedXML.Excel.XLColumns.<AdjustToContents>b__8(XLColumn c)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at ClosedXML.Excel.XLColumns.AdjustToContents()



Comments: Merged into master.

Closed Issue: System.InvalidOperationException: Sequence contains no elements [9022]

$
0
0
Getting the following exception when reading/evaluation a cell value that contains "=MAX(V7, W7) * 8%" formula:

An Exception occurred: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Max(IEnumerable`1 source)
at ClosedXML.Excel.CalcEngine.Tally.Max()
at ClosedXML.Excel.CalcEngine.Statistical.Max(List`1 p)
at ClosedXML.Excel.CalcEngine.FunctionExpression.Evaluate()
at ClosedXML.Excel.CalcEngine.Expression.op_Implicit(Expression x)
at ClosedXML.Excel.CalcEngine.BinaryExpression.Evaluate()
at ClosedXML.Excel.CalcEngine.Expression.op_Implicit(Expression x)
at ClosedXML.Excel.CalcEngine.BinaryExpression.Evaluate()
at ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression)
at ClosedXML.Excel.XLWorksheet.Evaluate(String expression)
at ClosedXML.Excel.XLCell.get_Value()

Both V7 and W7 cell values are blank, but excel handles this scenario by evaluating MAX to 0.0.
Comments: Fix merged into master

Closed Issue: XLHelper is not thread safe [9355]

$
0
0
This was reported as a comment in this issue

https://closedxml.codeplex.com/workitem/9348
Comments: Merged into master

Closed Issue: XLColor is not threadsafe [9354]

$
0
0
As reported in issue https://closedxml.codeplex.com/workitem/9348 XLColor is not thread safe.

I was able to reproduce this issue.
Comments: Merged into master

Closed Issue: IntegerExtension.ToStringLookup not threadsafe [9118]

$
0
0
Hi,
We are using this library in our service which generates several reports in parallel threads and we're getting the following exceptions:

System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at ClosedXML.Excel.IntegerExtensions.ToStringLookup(Int32 value)

This error is caused by those lines of code (of static class ClosedXML.Excel.IntegerExtensions):
private static readonly Dictionary<int, string> intToString = new Dictionary<int, string>();

public static string ToStringLookup(this int value)
{
if (!IntegerExtensions.intToString.ContainsKey(value))
IntegerExtensions.intToString.Add(value, value.ToString((IFormatProvider) IntegerExtensions.nfi));
return IntegerExtensions.intToString[value];
}

I think replace this dictionary by ConcurrentDictionary and use AddOrUpdate method will do the trick :)

Regards,
Maciej.
Comments: Merged into master

New Post: Protecting sheet

$
0
0
Hello team,
I am trying to protect a sheet with the password and while opening it using closedxml i should give the password and then open it.
Basically the sheet will reside in project folder and no one should open it, it can be opened only through code. Is this possible.

I know we can protect the cells, but i want to protect the sheet itself. is this possible in closedxml?
Viewing all 1877 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>