3
I have a system where I do some research at the bank and store everything in one Array
, but I have to put together a layout with this data so that they can be printed as labels on a matrix printer.
The part of the lines I have already formatted, but I don’t know how to make the next record of the list instead of going to the next line turn a column.
I need to leave it that way:
What I can get these days is this:
In this case my query returned only two results, the right would be to put this second line in a column as in the first image.
This is my class that generates the txt
:
public static void gerarTxt(List<Contrato> lista) {
try {
FileWriter arq = new FileWriter("C:\\etiqueta.txt");
PrintWriter gravarArq = new PrintWriter(arq);
for (Contrato item : lista) {
gravarArq.print(item.getContrato());
gravarArq.print("\r\n");
gravarArq.print(item.getContratante());
gravarArq.print("\r\n");
gravarArq.print(item.getRua().trim()+", "+item.getNumero());
gravarArq.print("\r\n");
gravarArq.print(item.getBairro());
gravarArq.print("\r\n");
gravarArq.print(item.getCep() + " "+item.getCidade()+ " "+StringUtils.leftPad(item.getUf(), 22));
gravarArq.print("\r\n");
gravarArq.print(".");
gravarArq.print("\r\n");
}
arq.close();
} catch (IOException e) {
e.printStackTrace();
}
}
How can I turn these rows into columns?
Update
Example of the Github project: https://github.com/sinkz/EtiquetaTeste
Look that question or this one in the Soen.
– user28595
I think that would solve it, but how to pass the next item on the list in the second column?
– DiegoAugusto