2012-04-02 2 views

답변

3

그것을 밖으로 시도하지하지만 아마 다음은 옳은 방향으로 당신을 가리 킵니다 : 형식으로 엑셀사용

nb_format = Spreadsheet::Format.new :number_format => '$#,###.##' 
cell.set_format(0, nb_format) 
+0

currency_format = 스프레드 시트 :: Format.new :로 number_format => '$ #, ## 0.00 _) [레드] ($ #, ## 0.00)' 시트 .row (index) .set_format (5, currency_format) 이것은 나에게 잘 맞았습니다. –

1

당신은 Excel의 통화 형식에 내장 중 하나를 사용하려면, 하나의 해킹입니다 원하는 형식으로 스프레드 시트 셀 (행 1, 열 A)을 선택합니다. 저장 후 엑셀 spreadsheet gem ~ read the format 엑셀을 사용하십시오. 내 경우에는 USD의 형식으로 _([$$-409]* #,##0.00_);_([$$-409]* \\(#,##0.00\\);_([$$-409]* \"-\"??_);_(@_)이 있습니다. 그런 다음과 같이 사용할 수 있습니다 :

currency_format = Spreadsheet::Format.new number_format: "_([$$-409]* #,##0.00_);_([$$-409]* \\(#,##0.00\\);_([$$-409]* \"-\"??_);_(@_)" 
sheet.row(r).set_format(col, currency_format)