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