【Excel】負数記号「△(▲)」の数値の書式設定をし、Excelファイルにエクスポートすると、負数記号が「-」になる
対象製品
SPREAD for .NET 2.5J Web Forms Edition
発生環境
動作保証環境と同様
状況
修正済み
詳細
負数記号「△(▲)」の数値の書式設定をした整数型セルまたは通貨型セルをExcelファイルにエクスポートした場合、負数記号が「-」として表示されてしまいます。
【手順】
1.新規WebフォームにSPREADとButtonを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.ボタンを押下してExcelファイルにエクスポートします
4.A1、B1セルの負数記号が「-」になります
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Page.IsPostBack Then
Return
End If
Dim ninfo As Globalization.NumberFormatInfo = CType(Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone(), Globalization.NumberFormatInfo)
ninfo.NegativeSign = "△"
ninfo.NumberDecimalDigits = 0
ninfo.CurrencySymbol = ""
ninfo.CurrencyDecimalDigits = 0
Dim ic As New FarPoint.Web.Spread.IntegerCellType
ic.NumberFormat = ninfo
FpSpread1.Sheets(0).Columns(0).CellType = ic
Dim dd As New FarPoint.Web.Spread.CurrencyCellType
dd.NumberFormat = ninfo
FpSpread1.Sheets(0).Columns(1).CellType = dd
For i As Integer = 0 To 1
FpSpread1.ActiveSheetView.Cells(0, i).Value = -1234
Next
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
FpSpread1.SaveChanges()
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.ボタンを押下してExcelファイルにエクスポートします
4.A1、B1セルの負数記号が「-」になります
【サンプルコード】
-------------------------
Webフォームクラス
-------------------------
Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Page.IsPostBack Then
Return
End If
Dim ninfo As Globalization.NumberFormatInfo = CType(Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone(), Globalization.NumberFormatInfo)
ninfo.NegativeSign = "△"
ninfo.NumberDecimalDigits = 0
ninfo.CurrencySymbol = ""
ninfo.CurrencyDecimalDigits = 0
Dim ic As New FarPoint.Web.Spread.IntegerCellType
ic.NumberFormat = ninfo
FpSpread1.Sheets(0).Columns(0).CellType = ic
Dim dd As New FarPoint.Web.Spread.CurrencyCellType
dd.NumberFormat = ninfo
FpSpread1.Sheets(0).Columns(1).CellType = dd
For i As Integer = 0 To 1
FpSpread1.ActiveSheetView.Cells(0, i).Value = -1234
Next
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
FpSpread1.SaveChanges()
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版で修正済み。
キーワード
SPRN07093
この文書は、以前は次のバグレポートIDで公開されていました : 7832