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

Free Support Forum - aspose.com

Duplicate Named Ranges through Aspose.Cells API

Hi there, we’re starting to use the Aspose.Cells named range API in order to find content that has been entered into Excel files. We’re currently working with Aspose.Cells 4.4.3.17, so we’re a little out of date. One curious thing that is happening with some Excel files is that the following API sample produces “extra” items in the Names collection:

Names names = this._workBook.Worksheets.Names;
this.rptrNamedRanges.DataSource = names;

I have this bound to a repeater. The repeater displays each Name instance’s RefersTo property and Text property. Some items appear to be duplicates in the rendered repeater. I.e. a partial copy and paste from the resultant rendered table of the repeater shows:

#REF!$B$186 access1 Yes Starts at: R185/C1, Size: 1R x 1C 0/0 Content: [[similar]] Click to View Range
=#REF!$B$186 access1 Yes Starts at: R185/C1, Size: 1R x 1C 0/0 Content: [[similar]] Click to View Range
=#REF!$B$186 access1 Yes Starts at: R185/C1, Size: 1R x 1C 0/0 Content: [[similar]] Click to View Range
=#REF!$B$186 access1 Yes Starts at: R185/C1, Size: 1R x 1C 0/0 Content: [[similar]]

Column 1 is the RefersTo property. Column 2 is the Text property. Before going further in analyzing the issue, do you know if this is a known issue with the current Aspose.Cells API, or if it was a known issue with our particular version of Aspose.Cells?

It does not seem to be happening with all Excel files that I am evaluating. Some seem to not have duplicate entries in the Worksheets.Names Aspose.Cells API. For this particular example, the Excel file does only show one instance of the named range “access1” within the Microsoft Excel Names manager, as well as in the Microsoft Excel named range navigator drop down. This is an Office 2003 file.

Thanks
Shan

Another related question - are there any significant enhancements between our Aspose.Cells version and the newest Aspose.Cells API as it is related to the parsing of named ranges in order to extract content from Workbooks?

Thanks

Hi,

Please try the attached latest version/fix v4.8.0.11, this issue should be fixed.

If you still find the issue, kindly give us details, sample code and template files to reproduce here, we will check it soon.

Thank you.

Hi Amjad, thanks for the follow up. Our license does not allow this version, see below. Do you have any other earlier versions that you know of that would still resolve this issue? Thanks ---------

The subscription included in this license allows free
upgrades until 27 May 2009, but this version of the product was
released on 16 Oct 2009. Please renew the subscription or use a
previous version of the product.

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description: </b>An

unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

        <b> Exception Details: </b>System.InvalidOperationException:

The subscription included in this license allows free upgrades until 27
May 2009, but this version of the product was released on 16 Oct 2009.
Please renew the subscription or use a previous version of the product.

        <b>Source Error:</b> <br><br>

        <table bgcolor="#ffffcc" width="100%">
           <tbody><tr>
              <td>
                  <code></code><pre>Line 34: <br>Line 35:             Aspose.Cells.License license = new Aspose.Cells.License();<br><font color="red">Line 36:             license.SetLicense(licenseFilePath);<br></font>Line 37: <br>Line 38:         }</pre></td></tr></tbody></table></font><br>

Hi,

Thank you for considering Aspose.

Please first comment the licensing code and test the latest version provided by Amjad to check if it works fine for you. If it works fine than you have to upgrade your license subscription to use the latest version of Aspose.Cells as the issue may exist in the previous versions.

Thank You & Best Regards,

Hi Nausherwan, I’ve tried your newest Excel API but it is still causing the duplicates issue. How can I post the Excel file to you privately so that you can review?

Shan

Hi Shan,

Thank you for considering Aspose.

As your file has some confidential data, you may check “Keep this post private” while replying to the post and attach your file. In this case only you and Aspose Staff will be able to see your post. Alternately, you can also send us your template file via email. Please follow the below mentioned steps to send us the file via email.

1: click the Contact button in the Post.

2: In the drop down list options click "Send nausherwan.aslam an Email”.

3: Attach the template file and send it.

4: Once you have done it, kindly confirm us on this thread.

Thank You & Best Regards,

Hi Nausherwam, confirmed, I’ve emailed it to you using the process you indicated.

Hi,

Thank you for considering Aspose.

We have received your template file and sample code via email. We will look into it and get back to you soon.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

This issue is caused by the named range belongs to different worksheet. So please change the codes to get the named range:

Name name = args.Item.DataItem as Name;

Range range = null;

if (name.SheetIndex == 0)

{

range = workbook.Worksheets.GetRangeByName(name.Text);

}

else

{

range = workbook.Worksheets.GetRangeByName(workbook.Worksheets[names[i].SheetIndex - 1].Name + "!" + name.Text);

}

We will provide a new method Name.GetRange to directly get the range by the name soon.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. We have supported Name.GetRange and Name.GetRanges() APIs for your need.

Thank You & Best Regards,

Hi Nausherwam, the API Name.GetRange() looks like it’s working great now. The duplicate Named Ranges (duplicate by their name and also by what they refer to) are no longer listed in the WorkBook.WorkSheets.Names collection. Thanks for your timely follow up.
Shan

The issues you have found earlier (filed as CELLSNET-11495) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.