Free Support Forum - aspose.com

Insert Columns in Excel 2007

Hi,

I am using Aspose.Cells.jar version 1.9.4_10 for java.

I have prepared a template in Excel 2007.

The issue is arising when I insert the columns, after inserting column it is disturbing the named ranges.

I have attached both template before inserting columns and template after inserting columns.

Cell CP49 should named as be CRT1___series.nenkei.groupid but CR49 became CRT1___series.nenkei.groupid.

Please help.

Thank You.
Kailas

Hi Kailas,

Thanks for the template files.

I tested and could not reproduce the problem, you have mentioned.

Could you explain in details and create a simple test code using your template file(s), zip it and post it here. We will check it soon.

Thank you.

Hi amjad,

I have attached the sample code.

Here the scenario is simulated.

Problem seems to be in copyWorksheet() method.

If I comment the asposeTest.renameNamedRanges(targetWorkbook, "CRT1"); call with respective changes in getPhysicalRangeName() function it works fine.

Please help.

Regards,
Kailas

Note: I have considered template path with respect to c:/

Hi Kailas,

Thanks for the sample test.

We will figure it out soon.

Thank you.

Hi Amjad,

Hope i will get quick response as my development is completely stopped because of this issue.

Thank You.

Regards,
Kailas

Hi Amjad,

After some debugging from my side, I found the problem while renaming the named range.

Instead of renaming the named range, if I clear the range and create the new named range with same row and column range it works properly.

Please have a look at it.

Thanks,
Kailas

Hi Kailas,

Thank you for your patience. Please try this attached fix.

Hi Johnson,

Thank You very much for your support.

The issue got resolved but I am facing another issue with this build.

Following statement is returning me Null value

NamedRange range = targetWorkbook.getWorksheets().getRangeByName("CRT1___report.header");

and CRT1___report.header is present in excel.

I am attaching sample code for this issue.

Regards,
Kailas

Hi Jhonson,

Any update on this.

Regards,
Kailas

Hi Kailas,

We will figure out your issue soon.

Thanks for being patient!

Hi Kailas,

For your case, please use "CRT1!name" in place of "name" to get those names, such as targetWorkbook.getWorksheets().getRangeByName("CRT1!CRT1___report.header"));

And I will provide overloaded method for Worksheets.getRangeByName() to get Name object with given name text without specifing sheet reference for your convenience soon. Thank you for being patient.

Hi Join,

Thanks for your response.

I am waiting for overloaded method as I have used it in many places.

Is there any performance related improvement using "CRT1!name" in place of "name".

Thanks
Kailas

Hi Kailas,

We will provide you the fix soon after some tests. The fix provides an overloaded method for Worksheets.getRangeByName(String rangeName) as getRangeByName(String rangeName, boolean strictScope), where the boolean flag means whether restrict Name object's scope when search it. For Worksheets.getRangeByName(String), if not specify the scope, will only search for the NamedRange object whose scope is workbook. It is identical to invoking getRangeByName(String, true); For Worksheets.getRangeByName(String, false), will search for the NamedRange object with any scope.

Using "CRT1!name" is just give a clue for searching from Name collection, it is better for performance when specify correctly the scope of searched Name, but not so distinct. For convenience, if you don't care about the scope, I think you can use getRangeByName(name, false) directly without specify scope in "name" to get any Name object

Hi Kailas,

Here is the fix, please try it.

Thank you.

Hi Amjad,

Thank You. Its working.

Regards
Kailas