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

Created Unassigned: Modifying table corrupts workbook [9403]

$
0
0
Following line of code will delete table column but also corrupt workbook and table will lose formatting:

table.Column(3).Delete(XLShiftDeletedCells.ShiftCellsLeft);

Created Unassigned: Cannot access table columns by header names [9404]

$
0
0
Following doesn't work:

table.Column("MyHeaderName").Delete(XLShiftDeletedCells.ShiftCellsLeft);

I get IndexOutOfRange exception.

Closed Unassigned: Modifying table corrupts workbook [9403]

$
0
0
Following line of code will delete table column but also corrupt workbook and table will lose formatting:

table.Column(3).Delete(XLShiftDeletedCells.ShiftCellsLeft);
Comments: Delete works as expected: var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet1"); ws.Cell("A1").SetValue("A") .CellBelow().SetValue(1); ws.Cell("B1").SetValue("B") .CellBelow().SetValue(2); var table = ws.RangeUsed().CreateTable(); table.Column("B").Delete( XLShiftDeletedCells.ShiftCellsLeft );

Closed Unassigned: Cannot access table columns by header names [9404]

$
0
0
Following doesn't work:

table.Column("MyHeaderName").Delete(XLShiftDeletedCells.ShiftCellsLeft);

I get IndexOutOfRange exception.
Comments: Then the table doesn't have a column with that name: var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet1"); ws.Cell("A1").SetValue("A") .CellBelow().SetValue(1); ws.Cell("B1").SetValue("B") .CellBelow().SetValue(2); var table = ws.RangeUsed().CreateTable(); table.Column("A").Style.Border.OutsideBorder = XLBorderStyleValues.Thick;

New Post: Github

$
0
0
I think CodePlex is the natural home for a project like this (being .net and all). Besides, it's not like people go to Github and search for stuff there.

New Post: Github

$
0
0
They do. I have seen open source projects jump in activity when posted on github. I have posted a copy on GitHub under my account. If you do post it, I will remove mine and fork from yours. Codeplex is awesome but GitHub is THE place for open source git projects. There are .net projects on github. I am a contributor to the GitExtensions project.

Created Unassigned: About This repository. [9405]

$
0
0
Hi,

Where is this project codebase repository?
Do you approve contributions for repository?

Thanks.

Reviewed: ClosedXML 0.76.0 (Dec 29, 2014)

$
0
0
Rated 5 Stars (out of 5) - Great tool. I didn't dig it in depth but it works well at least for simple scenarios and is fast.

Reviewed: ClosedXML 0.76.0 (Dec 30, 2014)

$
0
0
Rated 5 Stars (out of 5) - This was exactly what I was looking for, and worked exactly as I expected it to the first time I wrote the code and compiled. Thanks!

Created Unassigned: Shifted conditional formating colors after the sheet is overwritten or new sheet is added. [9406]

$
0
0
Hi,

great library, thank you!

I found a bug in conditional formating. I am filling cells in range with conditional formating setting the background colors by the content. This is the only part of my code that uses conditional format:

rangeDays.AddConditionalFormat().WhenStartsWith("D")
.Fill.SetBackgroundColor(XLColor.Red);
rangeDays.AddConditionalFormat().WhenStartsWith("p")
.Fill.SetBackgroundColor(XLColor.Cerise);
rangeDays.AddConditionalFormat().WhenStartsWith("N")
.Fill.SetBackgroundColor(XLColor.Yellow);
rangeDays.AddConditionalFormat().WhenStartsWith("S")
.Fill.SetBackgroundColor(XLColor.FromHtml("#9999FF"));
rangeDays.AddConditionalFormat().WhenStartsWith("§")
.Fill.SetBackgroundColor(XLColor.GreenYellow);

When I save a newly created excel it works fine. But If my code modifies already existing excel either by deleting the same named sheet and created a new one or by adding a new sheet which is filled in the same way as the previous one was then the conditional formating colors are shifted in this way:
D - #9999FF
p - GreenYellow
N - Red
S - Cerise
§ - Yellow
The palette looks shifted by 2.

If I do it one more time and add third sheet it gets even weirder:
conditional formating is shifted again, now more randomly, some are shifted from the previous step, some are not:
D - Cerise
p - GreenYellow
N - Red
S - Yellow
§ - #9999FF

And the weirdest part, the cells whose color is not set at all are now red

Commented Unassigned: Shifted conditional formating colors after the sheet is overwritten or new sheet is added. [9406]

$
0
0
Hi,

great library, thank you!

I found a bug in conditional formating. I am filling cells in range with conditional formating setting the background colors by the content. This is the only part of my code that uses conditional format:

rangeDays.AddConditionalFormat().WhenStartsWith("D")
.Fill.SetBackgroundColor(XLColor.Red);
rangeDays.AddConditionalFormat().WhenStartsWith("p")
.Fill.SetBackgroundColor(XLColor.Cerise);
rangeDays.AddConditionalFormat().WhenStartsWith("N")
.Fill.SetBackgroundColor(XLColor.Yellow);
rangeDays.AddConditionalFormat().WhenStartsWith("S")
.Fill.SetBackgroundColor(XLColor.FromHtml("#9999FF"));
rangeDays.AddConditionalFormat().WhenStartsWith("§")
.Fill.SetBackgroundColor(XLColor.GreenYellow);

When I save a newly created excel it works fine. But If my code modifies already existing excel either by deleting the same named sheet and created a new one or by adding a new sheet which is filled in the same way as the previous one was then the conditional formating colors are shifted in this way:
D - #9999FF
p - GreenYellow
N - Red
S - Cerise
§ - Yellow
The palette looks shifted by 2.

If I do it one more time and add third sheet it gets even weirder:
conditional formating is shifted again, now more randomly, some are shifted from the previous step, some are not:
D - Cerise
p - GreenYellow
N - Red
S - Yellow
§ - #9999FF

And the weirdest part, the cells whose color is not set at all are now red
Comments: Here are the images of the three steps. ![Image](http://i.imgur.com/k88LblI.png) ![Image](http://i.imgur.com/LOQDT8d.png) ![Image](http://i.imgur.com/GZROvDU.png) When I comment out the above code everything works fine. I am viewing it in Excel 2010.

Created Unassigned: Invalid UsedRange of worksheet [9407]

$
0
0
Hi, I am not sure if it is desired effect, but I get strange result using RangeUsed method of IXLWorksheet. My simple Excel file contains only two columns but with some special structure:

| | A | B |
| 1 | | B1 |
| 2 | A2 | B2 |

Edited Unassigned: Invalid UsedRange of worksheet [9407]

$
0
0
Hi, I am not sure if it is a desired effect, but I get strange result using RangeUsed method of IXLWorksheet. My simple Excel file contains only two columns but with some special structure (look at the attachment).

I get __B1__:__B3__, but if I'm looking at cells included in this range (CellsUsed()) there are no cells from __A__ column. But... using the same method on worksheet everything seems to be OK. It looks like the range is not computed correctly (or at least its cells).

I retrieve cells using:
```
var rangeUsedAddresses = rangeUsed.CellsUsed()
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());

// This one is correct
var worksheetAddresses = currentWorksheet.CellsUsed().
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());
```

Commented Unassigned: Invalid UsedRange of worksheet [9407]

$
0
0
Hi, I am not sure if it is a desired effect, but I get strange result using RangeUsed method of IXLWorksheet. My simple Excel file contains only two columns but with some special structure (look at the attachment).

I get __B1__:__B3__, but if I'm looking at cells included in this range (CellsUsed()) there are no cells from __A__ column. But... using the same method on worksheet everything seems to be OK. It looks like the range is not computed correctly (or at least its cells).

I retrieve cells using:
```
var rangeUsedAddresses = rangeUsed.CellsUsed()
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());

// This one is correct
var worksheetAddresses = currentWorksheet.CellsUsed().
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());
```
Comments: It's a bug. I can't believe I've never heard of it...

Commented Unassigned: Invalid UsedRange of worksheet [9407]

$
0
0
Hi, I am not sure if it is a desired effect, but I get strange result using RangeUsed method of IXLWorksheet. My simple Excel file contains only two columns but with some special structure (look at the attachment).

I get __B1__:__B3__, but if I'm looking at cells included in this range (CellsUsed()) there are no cells from __A__ column. But... using the same method on worksheet everything seems to be OK. It looks like the range is not computed correctly (or at least its cells).

I retrieve cells using:
```
var rangeUsedAddresses = rangeUsed.CellsUsed()
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());

// This one is correct
var worksheetAddresses = currentWorksheet.CellsUsed().
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());
```
Comments: Thanks for the reponse. It's a little tricky structure. I suppose that majority of Excel users always keep some full tabular data. Fortunately, CellsUsed works properly, but I'll be waiting for the fix. BTW. Is there a huge performence difference between those two methods of retrieving cells? If each of them returns different results it suggests that the code behind them is also a little bit (not just a little bit?) different.

Commented Unassigned: Invalid UsedRange of worksheet [9407]

$
0
0
Hi, I am not sure if it is a desired effect, but I get strange result using RangeUsed method of IXLWorksheet. My simple Excel file contains only two columns but with some special structure (look at the attachment).

I get __B1__:__B3__, but if I'm looking at cells included in this range (CellsUsed()) there are no cells from __A__ column. But... using the same method on worksheet everything seems to be OK. It looks like the range is not computed correctly (or at least its cells).

I retrieve cells using:
```
var rangeUsedAddresses = rangeUsed.CellsUsed()
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());

// This one is correct
var worksheetAddresses = currentWorksheet.CellsUsed().
.Select(c => c.Address)
.GroupBy(k => k.ColumnNumber).ToDictionary(k => k.Key, v => v.ToList());
```
Comments: Ok, I've looked at the source code and the main difference is that RangeAddress for Worksheet is not limited. Range-based method ignores everything before the first used column in the first used row. Maybe additional property (int FirstColumnInRange or whatever) set during Worksheet_Load and proper Range initialization later will solve the problem. It's just a suggestion (execution time will increase in such situations), so maybe you'll find a better solution.

New Post: Error when trying to open file

$
0
0
Error Info

System.IndexOutOfRangeException не обработано
Message=Индекс находился вне границ mассива.
Source=ClosedXML
StackTrace:
в ClosedXML.Excel.XLWorkbook.ParseReference(String item, String& sheetName, String& sheetArea) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:строка 792
   в ClosedXML.Excel.XLWorkbook.LoadDefinedNames(Workbook workbook) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:строка 716
   в ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:строка 385
   в ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:строка 48
   в ClosedXML.Excel.XLWorkbook.Load(String file) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:строка 37
   в ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook.cs:строка 651
   в ClosedXML.Excel.XLWorkbook..ctor(String file) в C:\Users\Kozlov_ag\Desktop\ClosedXml\ClosedXML_v0.76.0.0_.net3.5\ClosedXML\ClosedXML\ClosedXML\Excel\XLWorkbook.cs:строка 639
   в ClosedXml3._5.GenerateXlsxReport.Generate(String IputFile) в D:\Projects\ClosedXml3.5\ClosedXml3.5\Form1.cs:строка 50
   в ClosedXml3._5.Form1.button1_Click(Object sender, EventArgs e) в D:\Projects\ClosedXml3.5\ClosedXml3.5\Form1.cs:строка 28
   в System.Windows.Forms.Control.OnClick(EventArgs e)
   в System.Windows.Forms.Button.OnClick(EventArgs e)
   в System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   в System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   в System.Windows.Forms.Control.WndProc(Message& m)
   в System.Windows.Forms.ButtonBase.WndProc(Message& m)
   в System.Windows.Forms.Button.WndProc(Message& m)
   в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   в System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   в System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   в System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   в System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   в System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   в System.Windows.Forms.Application.Run(Form mainForm)
   в ClosedXml3._5.Program.Main() в D:\Projects\ClosedXml3.5\ClosedXml3.5\Program.cs:строка 18
   в System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   в System.Threading.ThreadHelper.ThreadStart()
InnerException:

If Worksheet name contains "," and print area then library create error.
library: ClosedXML_v0.76.0.0 for .net3.5

if need xslx file, i can send into email

Sorry for my English

Reviewed: ClosedXML 0.76.0 (Jan 07, 2015)

$
0
0
Rated 5 Stars (out of 5) - Works Perfect, thank you very much.

New Post: Table/range: how to check if contains column?

$
0
0
I want to check if a table contains column with specific name,
But getting exception when accessing not existing column.
Is there some way?

var tableMData = dataRange.AsTable();
if (tableMData.DataRange.Column("column name") == null)

. Specified argument was out of the range of valid values. Parameter name: The header row doesn't contain field name 'xxx'. at ClosedXML.Excel.XLTable.GetFieldIndex(String name) at ClosedXML.Excel.XLTableRange

Created Unassigned: DataRange.RowCount when no data in table [9408]

$
0
0
Hi,

I think there is a weird behavior in IXLDataTable.DataRange.RowCount().

My code:
var dataRange = worksheetMain.Range(cellTableStart, cellTableEnd);
var tableMData = dataRange.AsTable();

fileTotalRecords = tableMData.DataRange.RowCount();

If the original range contains:
1 header row
+2 data rows

The RowCount is 2.

If the range contains:
1 header row
+ No data

The RowCount is 1.

Looks like a bug?
Or is there an explanation?
Viewing all 1877 articles
Browse latest View live


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