Free Support Forum - aspose.com

Bug with Multiple group boxes of radio buttons that all have cell linking setup

Hello,


I have a workbook that has multiple group boxes of radio buttons. Each group box has the radio buttons pointing to a named range that i map values into with aspose.cells. These are setup via cell linking for the radio buttons. I have attached a test document that shows how this works in a very basic level for my case. What is happening is is that if i map a 3 to Current1 and open the model the 3rd item is selected in the group box but the value in the named range is 0. That named range should be also holding a 3.

The code is very simple to test this.
            _workbook = LoadWorkBook();
        <span style="color:blue;">var</span> range = _workbook.Worksheets.GetRangeByName("Current1");
        <span style="color:blue;">if</span> (range == <span style="color:blue;">null</span>) <span style="color:blue;">return</span>;
        range.Value = 3;

        <span style="color:green;">/*Send workbook to response*/</span>
        <span style="color:#2b91af;">OoxmlSaveOptions</span> xSaveOptions = <span style="color:blue;">new</span> <span style="color:#2b91af;">OoxmlSaveOptions</span>();
        xSaveOptions.SaveFormat = <span style="color:#2b91af;">SaveFormat</span>.Xlsx;

        <span style="color:#2b91af;">MemoryStream</span> tempStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>();
        _workbook.Save(tempStream, xSaveOptions);

        Response.ContentType = <span style="color:#a31515;">"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"</span>;
        Response.AppendHeader(<span style="color:#a31515;">"Content-Disposition"</span>, <span style="color:#a31515;">"attachment; filename="</span> + _workbook.FileName);
        Response.Flush();
        Response.BinaryWrite(tempStream.ToArray());
        Response.End();</pre><pre style="font-family: Consolas; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; ">Thanks,

Mark Tomlinson

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to see the problem using the latest version:
Aspose.Cells for .NET v7.1.2.5


Below is a screenshot for a reference.

Please also see the code below.

I have attached both the source and output files generated by the code.

We have logged this issue in our database. Development team will look into this issue and fix the problems and once, the fix is available or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-40551.


C#


string filePath = @“F:\Shak-Data-RW\Downloads\Test.xlsx”;


Workbook workbook = new Aspose.Cells.Workbook(filePath);


var range = workbook.Worksheets.GetRangeByName(“Current1”);

if (range == null) return;

range.Value = 3;


/Send workbook to response/

OoxmlSaveOptions xSaveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);


MemoryStream tempStream = new MemoryStream();

workbook.Save(tempStream, xSaveOptions);


byte[] outs = tempStream.ToArray();

File.WriteAllBytes(filePath + “.out.xlsx”, outs);

Screenshot:

Hi,

Please call ShapeCollection.UpdateSelectedValue() method. We do not update the shapes’ value when you set the value of the cell.

Please see the following code.

C#


Workbook workbook = new Workbook(@“D:\fileTemp\test.xlsx”);

var range = workbook.Worksheets.GetRangeByName(“Current1”);

if (range == null) return;

range.Value = 3;

workbook.Worksheets[0].Shapes.UpdateSelectedValue();

Ok thank you i will try this code snippet out. One thing though is that this does seem to work for every other group box that i set the named range for. If i set the value of Current1 then set Target1 the Target1 named range will keep its value i set and the group box will be set accordingly. This seems true for all others that i set but the first named range associated to the first group box.

Hi,

Thanks for your posting and using Aspose.Cells.

We think, ShapeCollection.UpdateSelectedValue() should fulfill your needs.

Please also download and try the latest fix:
Aspose.Cells for .NET (Latest Version)
and let us know your run results. It should fix your issue completely.

Let us know if you face any other issue, we will look into it and help you asap.