我想檢查電子表格中標題行旁邊的行是否爲空。如果它是空的,我想刪除表單。到目前爲止,我只能看到單元格A2並檢查它是否爲空,但有沒有辦法檢查整行?OpenXML如何檢查表單中的某行是否爲空
感謝
private void CheckForEmptyRow(WorkbookPart wbp, string sheetId)
{
Sheet sheet = wbp.Workbook.Descendants<Sheet>().FirstOrDefault(s => s.Id == sheetId);
WorksheetPart wsp = (WorksheetPart).(wbp.GetPartById(sheetId));
Cell cell = wsp.Worksheet.Descendants<Cell>().Where(c => c.CellReference == "A2").FirstOrDefault();
If (cell == null)
{
sheet.Remove();
wbp.DeletePart(wsp);
}
}