We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Alternative for worksheet.Dimension in aspose

Currently we are using EpPlus for excel calculation.
We are migrating to Aspose now.

var templateColOrder = new List();
worksheet = package.Workbook.Worksheets.SingleOrDefault(x => x.Name == Constants.TemplateType.Data_Collector);

            for (int col = worksheet.Dimension.Start.Column + 1; col <= worksheet.Dimension.End.Column; col++)
                templateColOrder.Add(new { Id = col - 1, ColName = worksheet.Cells[23, col].Text.Replace("\n", string.Empty) });

What will be alternate for above code? Address property of Aspose.cells.range returns a sting. So we are not able to manipulate it.
The above code is in c#

@ramyaraj10,

In Aspose.Cells APIs, you may try to use Worksheet.Cells.MaxDataRow and Worksheet.Cells.MaxDataColumn attributes to get your desired task.

Let us know if you still have any issue or confusion.

Worksheet.Cells.MaxDataRow will return only if there is data. Here are just downloading a empty template. you can revisit the for loop again and tell some suggestions.
image.png (52.1 KB)

I have debugged the high lighted the value in the screen shot. Please help how to achieve it?

@ramyaraj10,

If the worksheet is empty but having cells initialized with customized width/height or formattings (applied), then you may use Worksheet.Cells.MaxRow and Worksheet.Cells.MaxColumn attributes instead.

In case, the attributes are not giving what you want to achieve, kindly zip and attach your template Excel file and provide more details. We will check and help you soon.

Thank you the quick response. We are able to achieve it using “Worksheet.Cells.MaxColumn”.

Again we are stuck in the below line:

ExcelTable table = worksheetLandScape.Tables[“Table1”];
table.ShowFilter = false;

In EpPlus, we have property as “ExcelTable”, not sure what should be used in Aspose.
Also, what can be used instead of LoadFromDataTable and LoadFromCollection in Aspose
worksheetBOM.Cells[“A2”].LoadFromCollection(bomDraft, false);
It will greatful if you provide a solution.

@ramyaraj10,

Good to know that Worksheet.Cells.MaxColumn works for your needs well.

We have ListObject for tables in Excel spreadsheet. See the document on creating or managing Tables for your reference.

See the document with examples on some data importing options Aspose.Cells provides for your reference.

I have a code as below
List dealAttributeListPart1 = new List();
– added some values to the above string list
ImportTableOptions importOptions = new ImportTableOptions();
importOptions.IsFieldNameShown = false;

            worksheet.Cells.ImportCustomObjects((ICollection)dealAttributeListPart1, 3, 4,importOptions);

getting error as “parameter count mismatch”. Not sure what I am missing?

@ramyaraj10,

Please first see the example in the document and then devise your code accordingly. If you still find the issue, kindly create a standalone console application, zip the VS.NET project and post us here, we will check it soon.

PS. please do not include Aspose.Cells.Dll in the zipped archive project to minimize the size of the zipped file.