VB.NETでデータをエクセルに出力する際、Numberformatでマイナスの数値を ▲数値 と表示するには?


551  2007-08-09 21:18:35  No: 137119

With DataDynamics.SpreadBuilder.Workbook.Sheets(0)
  .Cell(intRow, intColumns).NumberFormat = "#,##0.0 ; [赤]-▲#,##0.0"
End With

で、実行してみたところ、Excelを開いた時に「ファイルエラー表示形式の設定が失われた可能性があります。」と出てきます。

当然、表示も数値が異なったりして表示できていません。
何か良い方法はないものでしょうか?
数値は、Double型で、少数第一位まで表示させます。

プログラム作成環境:
WindowsXP(日本語版)
VisualBasic.NET2005(日本語版)
Excel 2003(日本語版)


大吉末吉  2007-08-09 22:22:31  No: 137120

> With DataDynamics.SpreadBuilder.Workbook.Sheets(0)
「SpreadBuilder」って、VB.NET or Excelの標準機能にありましたっけ?? 

>   .Cell(intRow, intColumns).NumberFormat = "#,##0.0 ; [赤]-▲#,##0.0"

日本語での指定([赤])をするなら、「NumberFormat」ではなく「NumberFormatLocal」ではないでしょうか?

つまり、
>   .Cell(intRow, intColumns).NumberFormatLocal = "#,##0.0 ; [赤]-▲#,##0.0"
又は、
>   .Cell(intRow, intColumns).NumberFormat = "#,##0.0 ; [Red]-▲#,##0.0"
のどちらかでは・・・


※返信する前に利用規約をご確認ください。

※Google reCAPTCHA認証からCloudflare Turnstile認証へ変更しました。






  このエントリーをはてなブックマークに追加