This project has moved and is read-only. For the latest updates, please go here.

Formatting the text inside a table

Jan 9, 2014 at 11:23 AM
Hi, i'm using this code snipet below to create a table,

Table t = doc.Tables[0];
               // int linha = 1;
                t.RemoveRow(t.RowCount - 1);
                foreach (IServicoRelacionado item in ordemindice)
                {
                    t.InsertRow(t.Rows[t.RowCount - 1], t.Rows.Count);


                    Paragraph cell0 = t.Rows[t.RowCount - 2].Cells[0].Paragraphs[0];
                    //Paragraph cell0 = t.Rows[linha].Cells[0].Paragraphs[0];
                    cell0.InsertText(item.indice.ToString(), false);


                    Paragraph cell1 = t.Rows[t.RowCount - 2].Cells[1].Paragraphs[0];
                    //Paragraph cell1 = t.Rows[linha].Cells[1].Paragraphs[0];
                    cell1.InsertText(item.Nome, false);

                    Paragraph cell2 = t.Rows[t.RowCount - 2].Cells[2].Paragraphs[0];
                    //Paragraph cell2 = t.Rows[linha].Cells[2].Paragraphs[0];
                    cell2.InsertText(item.Quantidade.ToString(), false);


                    Paragraph cell3 = t.Rows[t.RowCount - 2].Cells[3].Paragraphs[0];
                    //Paragraph cell3 = t.Rows[linha].Cells[3].Paragraphs[0];
                    cell3.InsertText(GetValorFormatado(decimal.Round(item.Valor, 2)), false);

                    Paragraph cell4 = t.Rows[t.RowCount - 2].Cells[4].Paragraphs[0];
                    //Paragraph cell4 = t.Rows[linha].Cells[4].Paragraphs[0];
                    cell4.InsertText(GetValorFormatado(decimal.Round(item.ValorTotal, 2)), false);

                    //linha++;

                }
                t.RemoveRow(t.RowCount - 1);

            }

I need each cell to become BOLD and ITALIC, how can i accomplish this?
Any help would be useful.

Thanks in advance,

Lourival Borges.