作成日: 2017/10/05 最終更新日: 2017/12/22
文書種別
不具合
状況
修正済み
詳細
DefaultSheetStyleModelクラスを継承するとスタイルが正しく適用されない場合があります。
【再現手順】
1.サンプルコードをコピーしてアプリケーションを起動します
2.「コピー先」タブをクリックします
-- 「コピー元」のスタイルがコピーされません
【サンプルコード】
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FpSpread1.Sheets.Count = 2
FpSpread1.Sheets(0).SheetName = "コピー元"
FpSpread1.Sheets(1).SheetName = "コピー先"
FpSpread1.Sheets(0).AlternatingRows.Count = 2
FpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.RoyalBlue
Dim StyleModel1 As New DefaultSheetStyleModelEx(FpSpread1.Sheets(0))
FpSpread1.Sheets(1).Models.Style = StyleModel1
End Sub
End Class
Public Class DefaultSheetStyleModelEx
Inherits FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Private SheetView1 As FarPoint.Win.Spread.SheetView
Public Sub New(StyleSheet As FarPoint.Win.Spread.SheetView)
MyBase.New(StyleSheet.RowCount, StyleSheet.ColumnCount)
SheetView1 = StyleSheet
End Sub
Public Overrides Function GetCompositeInfo(row As Integer, column As Integer, altIndex As Integer, destInfo As FarPoint.Win.Spread.StyleInfo) As FarPoint.Win.Spread.StyleInfo
Return SheetView1.Models.Style.GetCompositeInfo(row, column, altIndex, destInfo)
End Function
End Class
【再現手順】
1.サンプルコードをコピーしてアプリケーションを起動します
2.「コピー先」タブをクリックします
-- 「コピー元」のスタイルがコピーされません
【サンプルコード】
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FpSpread1.Sheets.Count = 2
FpSpread1.Sheets(0).SheetName = "コピー元"
FpSpread1.Sheets(1).SheetName = "コピー先"
FpSpread1.Sheets(0).AlternatingRows.Count = 2
FpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.RoyalBlue
Dim StyleModel1 As New DefaultSheetStyleModelEx(FpSpread1.Sheets(0))
FpSpread1.Sheets(1).Models.Style = StyleModel1
End Sub
End Class
Public Class DefaultSheetStyleModelEx
Inherits FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Private SheetView1 As FarPoint.Win.Spread.SheetView
Public Sub New(StyleSheet As FarPoint.Win.Spread.SheetView)
MyBase.New(StyleSheet.RowCount, StyleSheet.ColumnCount)
SheetView1 = StyleSheet
End Sub
Public Overrides Function GetCompositeInfo(row As Integer, column As Integer, altIndex As Integer, destInfo As FarPoint.Win.Spread.StyleInfo) As FarPoint.Win.Spread.StyleInfo
Return SheetView1.Models.Style.GetCompositeInfo(row, column, altIndex, destInfo)
End Function
End Class
回避方法
Service Pack 2(v10.0.4006.2012)で修正済み。
Service Pack 2より前のバージョンでは次の回避方法が有効です。
------------------------------------------
DefaultSheetStyleModel型を返す独自の関数を新たに作成して、フォーム側のクラスから呼び出します。
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FpSpread1.Sheets.Count = 2
FpSpread1.Sheets(0).SheetName = "コピー元"
FpSpread1.Sheets(1).SheetName = "コピー先"
FpSpread1.Sheets(0).AlternatingRows.Count = 2
FpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.RoyalBlue
Dim StyleModel1 As New DefaultSheetStyleModelEx(FpSpread1.Sheets(0))
'FpSpread1.Sheets(1).Models.Style = StyleModel1
' 回避策(1)
FpSpread1.Sheets(1).Models.Style = StyleModel1.StyleSheetStyleModel
End Sub
End Class
Public Class DefaultSheetStyleModelEx
Inherits FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Private SheetView1 As FarPoint.Win.Spread.SheetView
' 回避策(2)
Public Function StyleSheetStyleModel() As FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Return SheetView1.Models.Style
End Function
Public Sub New(StyleSheet As FarPoint.Win.Spread.SheetView)
MyBase.New(StyleSheet.RowCount, StyleSheet.ColumnCount)
SheetView1 = StyleSheet
End Sub
Public Overrides Function GetCompositeInfo(row As Integer, column As Integer, altIndex As Integer, destInfo As FarPoint.Win.Spread.StyleInfo) As FarPoint.Win.Spread.StyleInfo
Return SheetView1.Models.Style.GetCompositeInfo(row, column, altIndex, destInfo)
End Function
End Class
Service Pack 2より前のバージョンでは次の回避方法が有効です。
------------------------------------------
DefaultSheetStyleModel型を返す独自の関数を新たに作成して、フォーム側のクラスから呼び出します。
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FpSpread1.Sheets.Count = 2
FpSpread1.Sheets(0).SheetName = "コピー元"
FpSpread1.Sheets(1).SheetName = "コピー先"
FpSpread1.Sheets(0).AlternatingRows.Count = 2
FpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.RoyalBlue
Dim StyleModel1 As New DefaultSheetStyleModelEx(FpSpread1.Sheets(0))
'FpSpread1.Sheets(1).Models.Style = StyleModel1
' 回避策(1)
FpSpread1.Sheets(1).Models.Style = StyleModel1.StyleSheetStyleModel
End Sub
End Class
Public Class DefaultSheetStyleModelEx
Inherits FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Private SheetView1 As FarPoint.Win.Spread.SheetView
' 回避策(2)
Public Function StyleSheetStyleModel() As FarPoint.Win.Spread.Model.DefaultSheetStyleModel
Return SheetView1.Models.Style
End Function
Public Sub New(StyleSheet As FarPoint.Win.Spread.SheetView)
MyBase.New(StyleSheet.RowCount, StyleSheet.ColumnCount)
SheetView1 = StyleSheet
End Sub
Public Overrides Function GetCompositeInfo(row As Integer, column As Integer, altIndex As Integer, destInfo As FarPoint.Win.Spread.StyleInfo) As FarPoint.Win.Spread.StyleInfo
Return SheetView1.Models.Style.GetCompositeInfo(row, column, altIndex, destInfo)
End Function
End Class
旧文書番号
41372