Like this:
public void impF(ref StringBuilder ret, int pos, string Texto, bool pulaLinha, float fs = 7.0F, int estilo = 0)
{
if (pulaLinha)
{
string x = ret + l(Texto, " ", pos - linha.Length) + "\r\n";
ret.Clear();
linha = "";
Paragraph paragrafo = new Paragraph(x, new Font(Font.FontFamily.COURIER, fs, estilo));
doc.Add(paragrafo);
}
else
{
//paragrafo.Add(l(Texto, " ", pos - linha.Length) + "\r\n");
ret.Append(l(Texto, " ", pos - linha.Length));
linha += l(Texto, " ", pos - linha.Length);
}
}
This way he mounts the line in the stringbuilder and when requested he adds to the paragraph.
I would like to add to the paragraph each independent text with its own style (bold, Italico, size etc)
It would be something like that:
public void impF(ref StringBuilder ret, int pos, string Texto, bool pulaLinha, float fs = 7.0F, int estilo = 0)
{
Paragraph paragrafo = new Paragraph(Texto, new Font(Font.FontFamily.COURIER, fs, estilo));
doc.Add(paragrafo);
if (pulaLinha)
{
doc.Add(new Paragraph("\r\n"));
}
}
This routine is called:
GeraRelatorio.impF(ref texto, 01, "Operação: " + row["cdescropera"].ToString(), true);
This works perfectly, but the style can only be applied to the entire line.
What do you mean "ahead of the previous" ?
– Leandro Angelo
@Leandroangelo I believe he is talking about continuing in the same line as the previous paragraph.
– Paz
This is a standard behavior, the right would be to make a Stringbuilder and generate its text property before passing the paragraph and adding it.
– Paz
@Magnocosta Include whole method code.
– Leandro Angelo
@Leandroangelo , that’s right, stay on the same line. The code basically this, I can include the whole routine, but will only add the "public void and }" at the end.
– Magno Costa
@Peace, then, at the moment is done just like that, I create a stringbuilder, I line up and send it to the paragraph, but this does not allow me to work the formats, for example: "CLIENT: ABC" being "CLIENT" in bold and ABC not.. understands?
– Magno Costa
Where is your Builder string? you are presenting the wrong part of the code is not where is your problem
– Leandro Angelo
@Leandroangelo below is the most complete code.
– Magno Costa