Created
December 24, 2020 10:42
-
-
Save sohail-aspose/ddb6500c965458e0d8e782163151427a to your computer and use it in GitHub Desktop.
Update References While Deleting Blank Rows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open an existing excel file. | |
Workbook wb = new Workbook("SampleInput.xlsx"); | |
// Get the worksheets collection in the spreadsheet. | |
WorksheetCollection sheets = wb.Worksheets; | |
// Get first Worksheet from WorksheetCollection by index. | |
Worksheet sheet = sheets[0]; | |
// This option will ensure the references (in formulas, charts) | |
// are updated while deleting blank rows. | |
DeleteOptions options = new DeleteOptions(); | |
options.UpdateReference = true; | |
// Delete the Blank Rows from the worksheet. | |
sheet.Cells.DeleteBlankRows(options); | |
// Save the excel file. | |
wb.Save("SampleOutput.xlsx"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment