Button properties

I'm copying a range that includes a button, however the copied button does not retain the same properties as the original. The property is .TextFrame.IsAutoMargin, which I'm assuming is the same property shown in Excel if I open the properties of the button (right click and then Format Control) on the Margins tab, Internal Margin, Automatic. The original has this checked, none of the copies do. I also tried to loop through each button to force that :

For Each shp As Aspose.Cells.Drawing.Shape In wbTemplate.Worksheets(x).Shapes
If shp.GetType.ToString = "Aspose.Cells.Drawing.Button" Then
shp.TextFrame.IsAutoMargin = True
End If
Next

This does correctly find the buttons and should be setting that property to true. One thing I noticed if I examine the properties for each button as it's running is that property is already set true. So the first question is, is that the correct property for what I want to do?

Rick

Hi Rick,

Thanks for your interest in Aspose.

Please attach your template file. And also a screenshot to show the Excel property which you want to modify.

You can create your template file in MS-Excel manually. We will investigate and provide you a solution.

I've attached the base file, along with screen captures from Excel showing the property differences between the original and copied buttons. The FirstMenu file is after I had right-clicked on the button, the SecondMenu shows the tab that has the property being affected. The Wrong file shows the property on a button copied by Aspose. As I said in the first message, I'm simply copying the the entire range to a couple cells below it using the following code:

range = cells.CreateRange((nCnt * 14) + nOffset, 2, False)
range.RowHeight = 20.25
range = cells.CreateRange((nCnt * 14) + nOffset + 2, 1, False)
range.RowHeight = 12.75
range = cells.CreateRange((nCnt * 14) + nOffset + 3, 8, False)
range.RowHeight = 24.75

range = cells.CreateRange("A6", "AQ16")
range2 = cells.CreateRange((nCnt * 14) + nOffset, 0, 11, 14)
range2.Copy(range)

range = cells.CreateRange("B9", "M16") ' just the formulas for the dates
range2 = cells.CreateRange((nCnt * 14) + 3 + nOffset, 1, 8, 12)
range2.CopyData(range)
'range2.CopyStyle(range)
range = Nothing range = cells.CreateRange((nCnt * 14) + nOffset, 2, False)
range.RowHeight = 20.25
range = cells.CreateRange((nCnt * 14) + nOffset + 2, 1, False)
range.RowHeight = 12.75
range = cells.CreateRange((nCnt * 14) + nOffset + 3, 8, False)
range.RowHeight = 24.75

range = cells.CreateRange("A6", "AQ16")
range2 = cells.CreateRange((nCnt * 14) + nOffset, 0, 11, 14)
range2.Copy(range)

range = cells.CreateRange("B9", "M16") ' just the formulas for the dates
range2 = cells.CreateRange((nCnt * 14) + 3 + nOffset, 1, 8, 12)
range2.CopyData(range)
'range2.CopyStyle(range)
range = Nothing

After the copy, the button does not keep the Automargin property setting. I've also tried to force that setting after the copy by using:

For Each shp As Aspose.Cells.Drawing.Shape In wbTemplate.Worksheets(x).Shapes
If shp.GetType.ToString = "Aspose.Cells.Drawing.Button" Then
shp.TextFrame.IsAutoMargin = True
End If
Next This code seems to have no effect. I have to open Excel and manually set each button to use Automargins. Note that this has been a problem with all version of cells I've tried, up to the most current (7.0.4.8)

Rick

Hi,

Thanks for your elaboration.

I understand the problem, but please provide me a full code so that I could run and test it and log it in our database.

Also, if you could provide/use a simpler source workbook in replicating the problem rather than MonthlyShaleForecastModelChart.xlsm, then it can speed up getting a fix.

Hi,

We have found this issue and logged it in our database.

Once, the issue is fixed or we have some update, we will let you know asap.

This issue has been logged as CELLSNET-40289

Hi,

We have fixed. this issue. Please download: Aspose.Cells for .NET v7.1.0.1

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.