【Excel】Excelファイルにエスポート時、テキスト型セルのAllowWrap プロパティの設定が正しく出力されない場合がある
対象製品
SPREAD for .NET 2.5J Web Forms Edition
発生環境
動作保証環境と同様
状況
修正済み
詳細
AllowWrap プロパティの設定が異なるテキスト型セルが2つあると、一方のテキスト型セルのAllowWrap プロパティの設定がもう一方のテキスト型セルにも適用された状態でExcelファイルにエスポートされます。
【手順】
1.新規WebフォームにSPREADとButtonを配置します。
2.下記サンプルコードをコピーし、アプリケーションを実行します。
3.Buttonを押下してExcelファイルを作成します。
---作成されたExcelファイルのA2セルの書式設定「折り返して全体を表示する」にチェックがつきません。
※本来はAllowWrap プロパティの設定により、「折り返して全体を表示する」にチェックがつくべきです。
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim tc1 As New FarPoint.Web.Spread.TextCellType
tc1.AllowWrap = False
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = tc1
FpSpread1.ActiveSheetView.Cells(0, 0).Value = "AllowWrap : False"
Dim tc2 As New FarPoint.Web.Spread.TextCellType
tc2.AllowWrap = True
FpSpread1.ActiveSheetView.Cells(1, 0).CellType = tc2
FpSpread1.ActiveSheetView.Cells(1, 0).Value = "AllowWrap : True"
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
FpSpread1.ActiveSheetView.Protect = False
Dim pathname As String = HttpContext.Current.Server.MapPath(Request.ApplicationPath + "/")
FpSpread1.SaveExcel(pathname + "test.xls")
FpSpread1.ActiveSheetView.Protect = True
End Sub
【手順】
1.新規WebフォームにSPREADとButtonを配置します。
2.下記サンプルコードをコピーし、アプリケーションを実行します。
3.Buttonを押下してExcelファイルを作成します。
---作成されたExcelファイルのA2セルの書式設定「折り返して全体を表示する」にチェックがつきません。
※本来はAllowWrap プロパティの設定により、「折り返して全体を表示する」にチェックがつくべきです。
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim tc1 As New FarPoint.Web.Spread.TextCellType
tc1.AllowWrap = False
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = tc1
FpSpread1.ActiveSheetView.Cells(0, 0).Value = "AllowWrap : False"
Dim tc2 As New FarPoint.Web.Spread.TextCellType
tc2.AllowWrap = True
FpSpread1.ActiveSheetView.Cells(1, 0).CellType = tc2
FpSpread1.ActiveSheetView.Cells(1, 0).Value = "AllowWrap : True"
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
FpSpread1.ActiveSheetView.Protect = False
Dim pathname As String = HttpContext.Current.Server.MapPath(Request.ApplicationPath + "/")
FpSpread1.SaveExcel(pathname + "test.xls")
FpSpread1.ActiveSheetView.Protect = True
End Sub
回避方法
2009/05/27版で修正済み。
キーワード
SPRN07080
この文書は、以前は次のバグレポートIDで公開されていました : 7926