Hi,
I am trying to get a range by its name but it returns nulll. The issue is not with all the excel sheets but with the attached excel sheet, I have checked the sheet and it defines the ranges properly and it works fine with the excelInterop library in the code. Not sure why its an issue with aspose.
xyz_upload123.zip (44.1 KB)
static void Main(string[] args)
{
var templatePath = @"C:\Temp\xyz_upload123.xlsx";
var fs = File.Open(templatePath, FileMode.Open);
var fileName = fs.Name.Split('\\')[fs.Name.Split('\\').Length - 1];
var workbook = new Workbook(fs);
workbook.FileName = fileName;
var renderedSheet = workbook.Worksheets["Rendering"];
var tableRange = renderedSheet.Workbook.Worksheets.GetRangeByName("TableRange");
renderedSheet.Cells.ClearContents(new CellArea
{
StartRow = tableRange.FirstRow,
EndRow = tableRange.FirstRow + tableRange.RowCount - 1,
StartColumn = tableRange.FirstColumn,
EndColumn = tableRange.FirstColumn + tableRange.ColumnCount - 1
});
fs.Close();
}
Could you please help ?
Thanks
Shobhit