Thanks in Advance
The code below is the try i did.
const string fileName = @"C:\Users\ljoseph\Documents\Book1.xlsx";
SpreadsheetDocument document = SpreadsheetDocument.Open(fileName, false);
WorkbookPart wbPart = document.WorkbookPart;
var sheets = wbPart.Workbook.Descendants
var sheet = sheets.First();
var workSheet = ((WorksheetPart)wbPart.GetPartById(sheet.Id)).Worksheet;
var sheetData = workSheet.Elements
var rows = sheetData.Elements
var row = rows.Where(r => r.RowIndex.Value == 2).First();
row.Hidden = true;
document.Close();
Console.Read();
Leon DPosted Aug 21, 2023, 1:28 AM
If you don't mind using other solutions, you can check the following example using Free Spire.XLS (https://www.e-iceblue.com/Download/download-excel-for-net-free.html)
Mohammadreza JahedbozorganPosted Aug 20, 2023, 3:06 PM
Hi,
First open the file for updating by passing true as the second parameter of SpreadsheetDocument.Open method. Second, after changing the Hidden property on row, save the workSheet.