An other small issue with names

Hi Guys…

I need a little help regarding adding names into Aspose which have no cells associated rather a formula associated with them…

For example if i try to add a formula " 3.14 x r x r " with name "Area"

where “r” is the name of a cell…

then how can i add “Area” in aspose…(since its not associated with any cell and its not going to be stored in any cell)

regards
safee

Hi safee,

Do you know how to do it in MS Excel? I can’t find it.

If MS Excel supports this feature, I will check and see if this feature can be implemented.

Hi Dear Laurence!!

I hope you are doing fine…

I must say its an excellent product you have got there and icing on the cake is your support Wink

About the problem…yes you can do that in excel as well…

Plz go to Drop down menus…

Insert>Name>Define and you will end at a dialog with an edit box asking for the name of the variable"names in workboo"… and in the “Refers to” edit box at the bottom of the dialog…plz remove the cell reference and enter a formula of your choice e.g. 7x9+10 etc…and press add button on the dialog and come back to spreadsheet…

Then proceed to any cell and type =name where name is the same name which you entered in the first edit box on the dialog… and you will see a computed value on that cell…

Also Dear Laurence, we need this feature for our product…its absolutely critical in our decision to opt for a full version…

Please Please do look into this and keep me posted…

Thanks a million…

Kind regards
safee[8-|]

Dear Safee,

Now I understand your need. I will check and implement this feature. Could you please tell me your expected date for this feature?

Yes Dear Laurence,

It would be REALLY GREAT if we can have it bundled with Aspose AS SOON AS POSSIBLE…so that my team can comeplte the evaluation and present our test code…

THanks again…

Kind Regards
safee

Hi safee,

We will make it ASAP. But it’s a complex feature, so I think it may take about 1 week. Could that serve your need?

Thanks a lot for the consideration Dear Laurence..

It shall be simply great...My team has to submit a proposal by next tuesday..So we have around 4 working days with us..
I must agree that its not a trivial job but can you please manage it somehow..pleaseeeee...Yes

We shall be really grateful!!

Kind regards
safee

Hi Safee,

Can you make a String represents the formula, and assign that string to any cell you would like to use that formula?

Say make a string Area as string.format("={0}:{1}:{2}:{3}, “3.14*”, r, “*”, r)

and then use Area on the cell u need the formula.

Hi me,

This feature is being currently implemented by Laurence and his team..and hopefully they will be updating the binary files next week..

Kind regards
safee

Hi safee,

Please download v3.0.4 at



The following is the sample code:

Excel excel = new Excel();

Names names = excel.Worksheets.Names;
Name name = names[names.Add(“Test”)];

name.RefersTo = “=4+5-1”;

excel.Worksheets[0].Cells[“B3”].Formula = “=Test”;

@safee,
Aspose.Cells has replaced Aspose.Excel that is no more available now. This new product has rich features to work with the workbooks including names management. You can set names for individual cells as well as set names for a range of cells. Note that you can set the range using absolute as well as relative reference. Here is an example that demonstrates adding names to individual cells and the range of cells.

Workbook workbook = new Workbook();
var coll = workbook.Worksheets.Names;
int index = coll.Add("Name1"); 
Name name = workbook.Worksheets.Names[index];
name.RefersTo = "=Sheet1!$A$1";

index = coll.Add("Name2");
name = workbook.Worksheets.Names[index];
name.RefersTo = "=Sheet1!$A$2:$C$10";

Range range = name.GetRange();

Style style = workbook.CreateStyle();
style.Font.IsBold = true;
style.Pattern = BackgroundType.Solid;
style.ForegroundColor = Color.Yellow;

StyleFlag styleFlag = new StyleFlag();
styleFlag.All = true;

range.ApplyStyle(style, styleFlag);
workbook.Save("output.xlsx");

Output

For more information on Name property refer to the following document:
Name

Following link can be used to download the latest free version of this product for trial purpose:
Aspose.Cells for .NET(Latest version)

A rich ready to run solution is available here that can be used to test variety of features in this product.