如何在C#中使用OpenXML隐藏Excel中的行? [英] How to hide rows in Excel using OpenXML in C#?
问题描述
如果我们可以隐藏空行,我尝试了很多寻找解决方案n在C#中使用OpenXML的Excel。如果有人有解决方案,如果你分享它会有很大的帮助。
我正在尝试:
SheetData sheetData = new SheetData();
SheetData sheetData = new SheetData();
Row emptyRow = new Row();
Row emptyRow = new Row();
emptyRow.Hidden = true;
emptyRow.Hidden = true;
sheetData.Append(emptyRow);
sheetData.Append(emptyRow);
推荐答案
嗨 21Singh,
>>我为寻找解决方案做了很多尝试如果我们可以在C#中使用OpenXML隐藏空白行。如果有人有解决方案,如果你分享它会有很大帮助。
你需要使用
BooleanValue 以表示row.Hidden属性的布尔值。
Hi 21Singh,
>>I tried a lot for finding a solution if we can hide blank rows n Excel using OpenXML in C#. If anyone has a solution to it, it will of great help if you share it.
You need to use BooleanValue to represent a Boolean value for row.Hidden attributes.
row = new Row();
row.Append(
ConstructCell(employee.Id.ToString(), CellValues.Number, 1),
ConstructCell(employee.Name, CellValues.String, 1),
ConstructCell(employee.Salary.ToString(), CellValues.Number, 1));
row.Hidden = new BooleanValue(true);
sheetData.AppendChild(row);
最好的问候,$
Yong Lu
Best Regards,
Yong Lu
这篇关于如何在C#中使用OpenXML隐藏Excel中的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!