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

Closed Unassigned: Problem with Symbols in Text Cells [9359]

$
0
0
I'm experiencing a problem when I assign a text value that contains a symbol in it to a cell.

For example: Cell(1,1).Value = "¡Oy Vey!";

The resulting cell in the worksheet displays a black diamond with a question mark in it where the extended character symbols should be.

When I look at a hex dump of the raw sharedStrings.xml file generated by ClosedXML, I cannot find the "¡" character or 0xA1 in hex in the file. Other extended characters do not work either.

I tried both Cell.Value and SetValue and with and without assigning the DataType to Text. All things I try have the same result.

I am new to ClosedXML, so perhaps there is a setting to enable it to not translate extended characters in text strings assigned to Cell values. I did not find anything related to this in the documentation.

//AJ
Comments: nothing to do

Commented Unassigned: System.OutOfMemoryException in v0.68.0.10, regression? [8808]

$
0
0
Hello,

In order to improve the speed of reading/writing of Excel files, I have recently updated ClosedXML from v0.64.0.0 to v0.68.0.10.

The kind of Excel file that I deal with is a big file, embedding a lot of VBA code ; I use it as a template, filling only 2 sheets with raw data (number or string, no formula).

The VBA developper improve this file continuously, for some files there was a huge speed difference, but we have arrived in a point where :

- With v0.64.0.0, we have the good results, but it is very slow
- With v0.68.0.10, the memory is increasing and then a "System.OutOfMemoryException" is thrown.

The exception is thrown in the code below

```
public XLWorkbook OpenExcel(MemoryStream xlsStream)
{
return new XLWorkbook(xlsStream, XLEventTracking.Disabled); //RR 13/06/2013 Turning off events
}
```

with v0.64.0.0 the memory is not increasing a lot during this operation (quite stable), but with v0.68.0.10 the memory used is increasing a lot (1 more GB) and then the exception occured.

I try to turn of the events, but it doesn't change anything.

Does anyone else had this issue before?

Thank you very much for your help.

Regards,
Renaud
Comments: Thank you for your work. Unfortunatly I no no longer work on this project, and I'm not able to test the project using the new lib.

New Post: Applyiing password in excel file using closedXml

$
0
0
Hi,
I have a requirement where i have to write data to excelworkbook using closedxml as well as making that excel file as protected(password).
i am able to generate data to file but not able to make the workbook as password protected,neither get any code snippet for it.Even in the discussion (https://closedxml.codeplex.com/discussions/539968)it is still pending...................

Any help is appreciable

Created Unassigned: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Commented Unassigned: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: Can you attach a reproduction case?

Commented Unassigned: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: Here are two examples of how I add conditional formatting: ``` ws.Range(fr, fc, lr, lc).AddConditionalFormat().WhenEqualOrLessThan(SlmConstants.InvalidVal) .Font.SetFontColor(XLColor.LightGray); ws.Range(fr, fc, lr, lc).AddConditionalFormat().WhenBetween(0, cf.ValOne) .Fill.SetBackgroundColor(XLColor.LightGray); ``` When my PC locale is en-US I get a '.' decimal separator, as expected, in the resulting xml. However, if my locale is set to fr-FR, for example, the decimal separator in the xml file is ',' (comma) which Excel considers 'unreadable content' and removes all conditional formatting. Regards, James Martin

Commented Unassigned: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: I am able to reproduce this. I will take a look into it.

Edited Task: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin


Updated Wiki: Home

$
0
0

Project Description

ClosedXML makes it easier for developers to create Excel 2007/2010 files. It provides a nice object oriented way to manipulate the files (similar to VBA) without dealing with the hassles of XML Documents. It can be used by any .NET language like C# and Visual Basic (VB).


What can you do with this?

ClosedXML allows you to create Excel 2007/2010 files without the Excel application. The typical example is creating Excel reports on a web server.

If you've ever used the Microsoft Open XML Format SDK you know just how much code you have to write to get the same results as the following 4 lines of code.

            var workbook = new XLWorkbook();
            var worksheet = workbook.Worksheets.Add("Sample Sheet");
            worksheet.Cell("A1").Value = "Hello World!";
            workbook.SaveAs("HelloWorld.xlsx");



Something more elaborate:

The Documentation page has an example of how to create the following table (Showcase) as well as many other examples:

Showcase.jpg

 

Commented Task: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: I opened the following pull request. https://closedxml.codeplex.com/SourceControl/network/forks/NickNack2020/ClosedXml/contribution/7280 This way resolve your issue, It solved the problem on my simple repro.

Source code checked in, #46de5a8a2119891cdf685e016a14ec13dc20107c

Source code checked in, #a0735e32dfac554170b3fd78c951a3d45342c5ad

$
0
0
Update Adjust to contents (gotta love doubles)

Source code checked in, #b10395cef6c307cd724792c486faee5638c727d5

$
0
0
Merge branch 'NickNack2020/ClosedXml'

Commented Task: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: Pick up the latest source code Theon and let us know if you still have problems.

Created Unassigned: Bug using LEFT() function on empty string [9362]

$
0
0
It seems to me there is a bug in ClosedXML.Excel.CalcEngine.Text.Left method.

In an excel cell, if we write formula:
```
=LEFT(A1)
```
and when A1 cell contains empty string, it fails:
> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ClosedXML.Excel.CalcEngine.Text.Left(List`1 p)

Before calling String,Substring, there should be some code to return the p[0] string if n is greater than p[0] length.

Commented Unassigned: Bug using LEFT() function on empty string [9362]

$
0
0
It seems to me there is a bug in ClosedXML.Excel.CalcEngine.Text.Left method.

In an excel cell, if we write formula:
```
=LEFT(A1)
```
and when A1 cell contains empty string, it fails:
> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ClosedXML.Excel.CalcEngine.Text.Left(List`1 p)

Before calling String,Substring, there should be some code to return the p[0] string if n is greater than p[0] length.
Comments: You're right. I'm fixing it now.

Commented Unassigned: Bug using LEFT() function on empty string [9362]

$
0
0
It seems to me there is a bug in ClosedXML.Excel.CalcEngine.Text.Left method.

In an excel cell, if we write formula:
```
=LEFT(A1)
```
and when A1 cell contains empty string, it fails:
> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ClosedXML.Excel.CalcEngine.Text.Left(List`1 p)

Before calling String,Substring, there should be some code to return the p[0] string if n is greater than p[0] length.
Comments: Thank you!

Source code checked in, #cab29f40e9db10461a24d67933fef273e5e77729

$
0
0
Fix Left, Right, and Mid functions for empty strings

Closed Unassigned: Bug using LEFT() function on empty string [9362]

$
0
0
It seems to me there is a bug in ClosedXML.Excel.CalcEngine.Text.Left method.

In an excel cell, if we write formula:
```
=LEFT(A1)
```
and when A1 cell contains empty string, it fails:
> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ClosedXML.Excel.CalcEngine.Text.Left(List`1 p)

Before calling String,Substring, there should be some code to return the p[0] string if n is greater than p[0] length.
Comments: Pick up the latest source code. I only fixed Left, Right, and Mid. I'll check the rest of the text functions later.

Commented Task: bug with localized conditional formatting [9361]

$
0
0
I have encountered an issue with conditional formatting when my PC's region and language settings are set to something other than English (specifically, French or Italian). When I create my spreadsheet and add a conditional format, in the <conditionalFormatting> section of sheet.xml, the <x:formula> field is storing the value with the CurrentCulture decimal separator (i.e. ',') instead of InvariantCulture (i.e. '.'). When the spreadsheet is opened by Excel I get an error saying Excel found unreadable content. If I click Yes to recover, I get the following message from the recovery report:

Removed Feature: Conditional formatting from /xl/worksheets/sheet.xml part

I have tried changing the CurrentCulture to "en" just before adding a conditional format (and restoring after) but then the <x:formula> field is stored as a string (although with the correct decimal separator) which gives undesired results in Excel.

Please Advise,
James Martin

Comments: This change did not fix the problem. Now, all the conditional formatting formulas have the correct decimal separator but are enclosed in "" which really confuses Excel (a lot of cells have conditional formatting applied that should not). This is the same result I had when I tried to change the CultureInfo before calling AddConditionalFormat(). Regards, Theon
Viewing all 1877 articles
Browse latest View live


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