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

Reviewed: ClosedXML 0.69.1 (Mar 28, 2014)

$
0
0
Rated 5 Stars (out of 5) - Thank-you so much! The code is very easy to use. There is enough documentation to get you going. And it is all very logical. Exactly what I was looking for. (Creating excel documents without having office installed).

New Post: Referring a formula in another worksheet

$
0
0
In C#, I am using

cell.SetFormulaA1("SUM('sheet1'!C8:'sheet1'!J8) + SUM('sheet2'!C9:'sheet2'!J9)");

to set a formula that uses other worksheets.

But then when I do this:

string content;
if (!cell.TryGetValue(out content)
{
...
}

it throws an exception.

What am I doing wrong?

New Post: Append to excel file

$
0
0
Hello,

I have an excel file (created with ClosedXML library) and I want to append new rows to existing excel file (same format as the original).
I was thinking about reading the original file and get the data, get the new data and save them all together in a file.

Is there other (maybe better) way to do this that I am missing?
Thanks!

New Comment on "Pivot Table example"

$
0
0
Hi, I think I have found a bug in the pivot generation process. If a data range is defined that includes a cell in it, that has text data that is bigger than 256 characters, the resulting excel file will be unreadable by MS Excel 2010. It is not relevant if that cell or cells are used in the pivot. If it is in range and bigger than 256 chars, the problem will surface. I am not sure where else I need to report this, should I put this also in the issues section?

New Post: Add datatable in customstarting cell range

$
0
0
I want to use this method

wb.Worksheets.Add(dataTable, "Data")

but I need to add the date range in the first 2 cells of my xml. I tried to add the datatable, copy the whole data a couple of cells below, but I lose the sorting function in the excel.

How can I add the dataTable in another location? Or how can I move a range of cells without losing the sorting header cell?

Thank you a lot!

New Post: Turn off header filtering

$
0
0
When my excel sheet loads, the headers are filtered. Can this be turned off?
Thanks

New Post: Turn off header filtering

$
0
0
Got It:

DataTable dt = ds.Tables[0];
var clsXLWorkbook = new XLWorkbook();
var ws = clsXLWorkbook.Worksheets.Add(dt);
ws.Tables.First().ShowAutoFilter = false;

Commented Unassigned: WorkSheet CopyTo doesn't transform Named Ranges addresses [9270]

$
0
0
I'm trying to replicate a Worksheet several time in a Workbook and I'm doing using the following code:
```
IXLWorksheet worksheet = modelSheet.CopyTo("SheetName");
```
When I open the generated document the NamedRanges were copied, using the same name as expected, but all of them are associated to the model worksheet (source). I was expecting the NamedRange address to be changed to the target Worksheet too.

Example:
```
"=ModelSheet!$B$10:$B$10" would transform to "=TargetSheet!$B$10:$B$10"
```

Is there a way to do it or isn't it supported yet?

Many Thanks & great work my man, incredible Lib!
Cheers!
Comments: ** Comment from web user: Rynkadink **

Meanwhile... I did create an Extension Method as a workaround;
It might be usefull to someone else:

```
public static class ClosedXml
{
public static IXLWorksheet CopyToWithNamedRanges(this IXLWorksheet sourceSheet, String targetSheetName)
{
if (sourceSheet == null)
{
throw new ArgumentNullException("Source Worksheet is Null!");
}

// # Call ClosedXML API CopyTo method

IXLWorksheet targetWorksheet = sourceSheet.CopyTo(sourceSheet.Workbook, targetSheetName);

// # Process copied Worksheet NamedRanges,
// Change Address reference replacing the source Worksheet name with newly created
// Worksheet (by copy) name.

foreach (IXLNamedRange namedRange in targetWorksheet.NamedRanges.Select(r => r))
{
// Get the source worksheet name from address

string[] splitAddress = namedRange.RefersTo.Split(new char[] { '!' }, 2);

string worksheetName = splitAddress[0];

// Enclose the target worksheet name in single quotes

string targetWorksheetName = String.Format("'{0}'", targetWorksheet.Name);

// Change the range reference address

namedRange.RefersTo = namedRange.RefersTo.Replace(worksheetName, targetWorksheetName);
}

return targetWorksheet;
}
}
```


New Post: Table & Charting

$
0
0
Given that I'm probably going to go with the third option here: "A last resort would be to modify the file with ClosedXML and then modify the chart with another library like the OpenXML SDK." Would it work to get the open xml objects from the closed xml objects, something like:
        var workbook = new XLWorkbook();
        var worksheet = workbook.Worksheets.Add("Sample Sheet");
        WorksheetPart worksheetPart = getWorksheetPart(worksheet); 
where the method getWorksheetPart performed some sort of reflection on the worksheet object to access the underlying WorksheetPart? Or would that be a bad idea?

New Post: Cells.InsertDataTable Time values are recognized as String

$
0
0
I do hope that the developer of this library will improve the InsertDataTable method so that I won't come up with this kind of code again.

Many thanks in advance. :)

Source code checked in, #80797

$
0
0
Rename tests and their files to comply to coding conversions

Source code checked in, #80799

Source code checked in, #80800

New Comment on "Documentation"

Commented Unassigned: Pivot Tables Values Problem [9088]

$
0
0
Based on the example [Pivot Tables](https://closedxml.codeplex.com/wikipage?title=Pivot%20Table%20example) , do the following steps to reproduce the problem

Excellent example . It works perfect, but if you add more than one value will have a problem . Here I leave an example to reproduce the problem . Suppose Pastry class has one more property called "Amount" int

Step 1. Add two values

```
// The values ​​in our table will come from the " NumberOfOrders " field
// The default setting is a full calculation of each row / column
pt.Values.Add ("NumberOfOrders");

// Another value ( THIS IS THE ONE THAT CAUSE THE PROBLEM )
pt.Values.Add ("Amount" ) ;

```


Step 2. Save the excel file

Step 3. Open the excel file , and throw the following message

We found a problem with Content ' Patry.xlsx ' . Do you want to try to recover as much content as possible ? If trusts origin of this book , please click yes .

Click yes, and I'll get the following message :

Removed Feature: PivotTable report from / xl / PivotTables / pivotTable.xml part ( PivotTable view)
Records removed : book Properties / xl / workbook.xml part ( Book)


Step 4. Final result , the pivot table is not generated

aTTACH project C# for reproduce problem.

Please expect your help to solve this problem .. thank you very much
Comments: ** Comment from web user: freakinhuge **

Has anyone been able to get this to work yet? I really need to make a pivot table with multiple value fields and it seems that everything out there can't do it..


Commented Unassigned: Pivot Tables Values Problem [9088]

$
0
0
Based on the example [Pivot Tables](https://closedxml.codeplex.com/wikipage?title=Pivot%20Table%20example) , do the following steps to reproduce the problem

Excellent example . It works perfect, but if you add more than one value will have a problem . Here I leave an example to reproduce the problem . Suppose Pastry class has one more property called "Amount" int

Step 1. Add two values

```
// The values ​​in our table will come from the " NumberOfOrders " field
// The default setting is a full calculation of each row / column
pt.Values.Add ("NumberOfOrders");

// Another value ( THIS IS THE ONE THAT CAUSE THE PROBLEM )
pt.Values.Add ("Amount" ) ;

```


Step 2. Save the excel file

Step 3. Open the excel file , and throw the following message

We found a problem with Content ' Patry.xlsx ' . Do you want to try to recover as much content as possible ? If trusts origin of this book , please click yes .

Click yes, and I'll get the following message :

Removed Feature: PivotTable report from / xl / PivotTables / pivotTable.xml part ( PivotTable view)
Records removed : book Properties / xl / workbook.xml part ( Book)


Step 4. Final result , the pivot table is not generated

aTTACH project C# for reproduce problem.

Please expect your help to solve this problem .. thank you very much
Comments: ** Comment from web user: estyfen **

It has not yet been fixed. Finally I decided to explain to my clients, they must manually add the columns to the dynamic table to complete. :)

Reviewed: ClosedXML 0.69.1 (Apr 09, 2014)

$
0
0
Rated 5 Stars (out of 5) - This project has saved me countless frustrating hours. I was able to do exactly what I needed to do with zero issues. Thanks! I suggest setting up a donations box.

Created Unassigned: Setting of Initial Zoom of Spreadsheet [9289]

$
0
0
It would be nice if the Zoom level (View Tab) for a worksheet could be set via ClosedXML.

The following discussion goes into a bit more detail of how the feature could be implemented

https://closedxml.codeplex.com/discussions/249997

New Comment on "Conditional Formatting"

$
0
0
How can i check conditional format with TimeSpan apart from this var condFormat1 = worksheet.Range(3, 8, 32, 8).AddConditionalFormat().WhenGreaterThan("00:30:00").Fill.SetBackgroundColor(XLColor.Red);

New Comment on "Conditional Formatting"

$
0
0
How can i check conditional format with a TimeSpan
Viewing all 1877 articles
Browse latest View live


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