作成日: 2019/06/26 最終更新日: 2021/05/26
文書種別
不具合
状況
修正済み
詳細
他の名前付きスタイルを指定してNamedStyleを作成した場合、親のスタイルまでしか引き継がれません。親の名前付きスタイルが他のスタイルを参照していたとしても、参照先のスタイルはセルに反映されません。
■サンプルコード(VB.NET)
■サンプルコード(VB.NET)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 名前付きスタイルの作成と登録
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("ns1")
ns1.BackColor = Color.Aqua
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("ns2", "ns1")
ns2.ForeColor = Color.Red
Dim ns3 As New FarPoint.Win.Spread.NamedStyle("ns3", "ns2")
ns3.Font = New Font(Me.Font, FontStyle.Bold)
FpSpread1.NamedStyles.AddRange(New FarPoint.Win.Spread.NamedStyle() {ns1, ns2, ns3})
' 名前付きスタイルの設定
FpSpread1.ActiveSheet.Cells(0, 0).StyleName = "ns1"
FpSpread1.ActiveSheet.Cells(0, 1).StyleName = "ns2"
FpSpread1.ActiveSheet.Cells(0, 2).StyleName = "ns3"
' テスト用データの設定
FpSpread1.ActiveSheet.Cells(0, 0, 0, 2).Value = "abc"
End Sub
' 名前付きスタイルの作成と登録
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("ns1")
ns1.BackColor = Color.Aqua
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("ns2", "ns1")
ns2.ForeColor = Color.Red
Dim ns3 As New FarPoint.Win.Spread.NamedStyle("ns3", "ns2")
ns3.Font = New Font(Me.Font, FontStyle.Bold)
FpSpread1.NamedStyles.AddRange(New FarPoint.Win.Spread.NamedStyle() {ns1, ns2, ns3})
' 名前付きスタイルの設定
FpSpread1.ActiveSheet.Cells(0, 0).StyleName = "ns1"
FpSpread1.ActiveSheet.Cells(0, 1).StyleName = "ns2"
FpSpread1.ActiveSheet.Cells(0, 2).StyleName = "ns3"
' テスト用データの設定
FpSpread1.ActiveSheet.Cells(0, 0, 0, 2).Value = "abc"
End Sub
回避方法
Service Pack 4(v11.0.4505.2012)で修正済み。
Service Pack 4 を適用せずに対処する方法としては、Cloneメソッドで情報をコピーしてから新しいスタイルを設定する方法で回避が可能です。
■サンプルコード(VB.NET)
■サンプルコード(VB.NET)
' 名前付きスタイルの作成と登録
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("ns1")
ns1.BackColor = Color.Aqua
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("ns2", "ns1")
ns2.ForeColor = Color.Red
'Dim ns3 As New FarPoint.Win.Spread.NamedStyle("ns3", "ns2")
' 回避策
Dim ns3 As New FarPoint.Win.Spread.NamedStyle
ns3 = ns2.Clone()
ns3.Name = "ns3"
ns3.Font = New Font(Me.Font, FontStyle.Bold)
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("ns1")
ns1.BackColor = Color.Aqua
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("ns2", "ns1")
ns2.ForeColor = Color.Red
'Dim ns3 As New FarPoint.Win.Spread.NamedStyle("ns3", "ns2")
' 回避策
Dim ns3 As New FarPoint.Win.Spread.NamedStyle
ns3 = ns2.Clone()
ns3.Name = "ns3"
ns3.Font = New Font(Me.Font, FontStyle.Bold)
旧文書番号
84120