简体   繁体   English

如何在Android SD卡中制作表格格式的文本文件?

[英]how to make table formatted text file in android sd card?

I see this to make text file and it also helps me out but in all examples i see that they just making string in notepad or we can say text file... Can any one say that how to make table formatted text file in android?? 我看到这可以制作文本文件 ,这也对我有帮助,但是在所有示例中,我看到它们只是在记事本中创建字符串,或者我们可以说文本文件...有人可以说如何在android中制作表格格式的文本文件吗? ?

i want to make file(invoice) 我要制作文件(发票)

That would be TSV format, and it is very easy to generate. 那将是TSV格式,并且很容易生成。 Just add a TAB after every field, and a CR/LF pair after every record. 只需在每个字段之后添加一个TAB,并在每个记录之后添加一个CR / LF对。

This is most likely going to involve some some slightly messy string processing. 这很可能会涉及一些稍微混乱的字符串处理。 Assuming you have your data in an acceptable format (such as string arrays), you should be able to construct a single java string representing the whole table, and then use the code you found already to print it to a file. 假设您的数据采用可接受的格式(例如字符串数组),则应该能够构造一个代表整个表的java字符串,然后使用找到的代码将其打印到文件中。 Use the escape character \\t to separate between columns and \\n to separate between rows. 使用转义符\\t分隔列,并使用\\n分隔行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM