本文介紹了如何用前導零寫入csv?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我希望將一些數據寫入 CSV 文件.我輸入信息的一列是帶前導零的整數形式,例如:0000000013.
I wish to write to a CSV file some data. One of the column that I input the information is in the form of an integer with leading zeros, example: 0000000013.
由于某種原因,excel 將其轉換"為 13,我必須使用 10 位數字 (0000000013).誰能告訴如何規避這個問題?
For some reason, excel 'converts' it to 13, and I must have it with 10 digits (0000000013). Can anyone tell how this can be circumvented?
String value = "0000000013"; //I tried String.format("%8d", 13) doesn't work
printWriter.println(value);
謝謝!!!
推薦答案
在行首添加單引號 '
.這會通知 Excel 不要將該值視為數字.
Add a single quote, '
, at the start of the line. This informs Excel to not treat the value as a number.
這篇關于如何用前導零寫入csv?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!