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

Free Support Forum - aspose.com

Name Manager - List of names

Hello,

Is it possible to get all names present in Formulas > Name Manager (Excel function).

I try to use these 2 functions, but the returned list is not complete:

  • workbook.getWorksheets().getNamedRangesAndTables();
  • workbook.getWorksheets().getNames();

Thank you.

Hi,


Thanks for providing us some details.

workbook.getWorksheets().getNames()

By using this line, it should return all the named ranges in Name manager (in MS Excel). Could you provide us your template Excel file, we will check it soon.

Thank you.

Excel file in attachment.

Hi,


Thanks for your posting and using Aspose.Cells.

We found, your source excel file is corrupt. Please see the attached screenshots for your reference. If some excel file is corrupt and you try to load it in Workbook object, then you will get some exception or unexpected or invalid results. So, please fix your excel file. You can fix it via Microsoft Excel by opening (repairing) and then re-saving it.

It is not really corrupted.
If I work in a french environment, Excel allows me to create 2 references with the following names, without problem :

  • Print_Area
  • Zone_d_impression

But if you open the document in an English environment, “Zone_d_impression” is automatically translated to “Print_Area”, and you have an error, because you cannot have the same name twice in the same sheet.

My goal is to identify, using Aspose, the presence of 2 references in the same sheet, with the name “Print_Area” and “Zone_d_impression”.


Or maybe there is another way to identify these kind of corrupted file (or any Excel file with a popup message at opening).

Thank you.

Hi,


Thanks for your posting and using Aspose.Cells.

Please let us know how to open it in English Microsoft Excel. I have changed the Regional Settings to French (France) and it is still prompting me as I have shown in my screenshot previously.

It’s the version of your office product, not Windows.

I have 2 different computers to test, one with Fench Excel, the other with English Excel.
I know that there is a software to change the language pack, but I’ve never tested.

Hi,


Thanks for your posting and using Aspose.Cells.

We have tested your issue with the following sample code using your source excel file with the latest version. Please check its console output and let us know if there is any error inside it or if it is correct. Let us know which name is missing. Screenshots of your missing ranges will be helpful for us to investigate and fix this issue. Thanks for your cooperation in this regard and have a good.

Please download and try the following latest fix: Aspose.Cells for Java v16.12.7 and let us know your feedback.
Java
Workbook wb = new Workbook(dirPath + “test_ref.xlsx”);

NameCollection names = wb.getWorksheets().getNames();

for(int i=0; i<names.getCount(); i++)
{
Name nm = names.get(i);
System.out.println(nm);
}

Console Output
Aspose.Cells.Name [ _FILTERDATABASE; ReferTo:=Panel!$A$1:$IL$247]
Aspose.Cells.Name [ PRINT_AREA; ReferTo:=Introduction!$D$16:$D$17]
Aspose.Cells.Name [ PRINT_AREA; ReferTo:=Panel!$B$228]
Aspose.Cells.Name [ PRINT_AREA; ReferTo:='Queries '!$D$14:$D$16]

Hi,

In attachment the complete list of ranges.
For each sheet, there is one missing name, because Zone_d_impression is translated to Print_Area.

Hi,


Thanks for your screenshot and considering Aspose.Cells.

We were able to observe this issue and found, Aspose.Cells is not returning all the names as you have shown in the screenshot. We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-42150 - GetNames() method is not returning all the names

Hi,

Thanks for using Aspose.Cells.

We have looked into this issue further and found Aspose.Cells works fine. As we said in the previous post, the file is corrupted in MS Excel(US) because there are some duplicate defined names. Aspose.Cells removes those duplicate defined names to make the file work fine in MS Excel(US).

Please check the data in workbook.xml from your template file:

Panel!$A$1:$IL$247 Introduction!$A$1:$E$44 Panel!$A$1:$V$242 'Queries '!$B$3:$C$3 Introduction!$D$16:$D$17 Panel!$B$228 'Queries '!$D$14:$D$16

Hi,

Is it not possible to detect duplicate names ?

Because if we don’t save the document, it is never corrected, and it’s important in our process to identify this kind of document.

I know it’s possible using other libraries than Aspose, but I prefer open the document once, only with Aspose.

Thank you for your help.

Hi,


Thanks for using Aspose.Cells.

We have logged your comment in our database against this issue. We will look into it further and update you. Once, there is some news for you, we will let you know asap.

Hi,


This is to update you that your issue logged earlier as “CELLSJAVA-42150” has been fixed. We will soon provide you the fix after performing QA and incorporating other enhancements and fixes.

Thank you.

Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix: Aspose.Cells for Java v17.1.4 and let us know your feedback.

Please try the fix with the following code.


Java
private class WarningCallback implements IWarningCallback
{
public void warning(WarningInfo warningInfo)
{
if(warningInfo.getWarningType() == WarningType.DUPLICATE_DEFINED_NAME)
{
System.out.println(“Duplicate Defined Warning Occurred.”);
}
}
}

public void CELLSJAVA42150() throws Exception {

LoadOptions options = new LoadOptions();
options.setWarningCallback(new WarningCallback());
Workbook book = new Workbook(dirPath + “CELLSJAVA42150.xlsx”, options);

book.save(dirPath + “CELLSJAVA42150.xlsx”);
}
C#
public void CELLSJAVA42150()
{
LoadOptions options = new LoadOptions();
options.WarningCallback = new WarningCallback();
Workbook book = new Workbook(dirPath + “CELLSJAVA42150.xlsx”, options);
book.Save(dirPath + “CELLSJAVA42150.xlsx”);
}

private class WarningCallback : IWarningCallback
{
public void Warning(WarningInfo warningInfo)
{
Assert.AreEqual(warningInfo.WarningType, WarningType.DuplicateDefinedName);
}
}

I have an exception when a document have duplicate print area name.

Thank you.

Hi,


Yes, that’s the way we have sorted your issue out accordingly. Hopefully it will suit your needs well. In the event of any query or issue, feel free to write us back.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-42150) have been fixed in Aspose.Cells for Java 17.2.0.


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