You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to add a conditional format to a range of cells (column X) that means:
Color all the cells in column X that their value is different than the value on the same row in column Y.
I need to do it in C# , dynamically, without a loop.
What is the expected behavior or new feature?
I expect that will be a way to do something like this:
int StatusX = worksheet.FirstRowUsed().CellsUsed().First(c => c.Value.ToString() == "StatusX ").Address.ColumnNumber;
var StatusXRange= worksheet.Column(StatusX);
int StatusY= worksheet.FirstRowUsed().CellsUsed().First(c => c.Value.ToString() == "StatusY").Address.ColumnNumber;
var StatusYRange = worksheet.Column(StatusY);
StatusYRange.AddConditionalFormat().WhenIsTrue(StatusY.Value!=StatusX.value).Fill.SetBackgroundColor(XLColor.Cyan); //How should I do it?
What is the best way to do it?
Is this a regression from the previous version?
I dont know
Reproducibility
This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.
Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.
Code to reproduce problem:
publicvoidMain(){IXLWorksheetworksheet;if(workbook.Worksheets.TryGetWorksheet(sheetName,out worksheet)){// Worksheet with that name already exists
ws.Clear();}else{worksheet= workbook.AddWorksheet(sheetName);}DataTabledt= ToDataTable(itemList);
worksheet.Cell(1,1).InsertTable(dt);intStatusX= worksheet.FirstRowUsed().CellsUsed().First(c => c.Value.ToString()=="StatusX ").Address.ColumnNumber;varStatusXRange= worksheet.Column(StatusX);intStatusY= worksheet.FirstRowUsed().CellsUsed().First(c => c.Value.ToString()=="StatusY").Address.ColumnNumber;varStatusYRange= worksheet.Column(StatusY);
StatusYRange.AddConditionalFormat().WhenIsTrue(StatusY.Value!=StatusX.value).Fill.SetBackgroundColor(XLColor.Cyan);}
I attached a sample spreadsheet. (You can drag files on to this issue)
The text was updated successfully, but these errors were encountered:
Read and complete the full issue template
Do not randomly delete sections. They are here for a reason.
Do you want to request a feature or report a bug?
Did you test against the latest CI build?
If you answered
No
, please test with the latest development build first.Version of ClosedXML
e.g. 0.95.3
What is the current behavior?
I tried to add a conditional format to a range of cells (column X) that means:
Color all the cells in column X that their value is different than the value on the same row in column Y.
I need to do it in C# , dynamically, without a loop.
What is the expected behavior or new feature?
I expect that will be a way to do something like this:
What is the best way to do it?
Is this a regression from the previous version?
I dont know
Reproducibility
This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.
Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.
Code to reproduce problem:
The text was updated successfully, but these errors were encountered: