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);
}
}
In this way it mounts the line in the stringbuilder and when requested adds to the paragraph.
I would like to add each independent text to your paragraph (bold, italic, size, etc.)
It would look something like this:
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 this:
GeraRelatorio.impF(ref texto, 01, "Operação: " + row["cdescropera"].ToString(), true);
It works perfectly, however, the style can only be applied to the entire line.