I have a table with a cell where I want two texts, the first aligned left and the second aligned right on the same cell in the same row.
I tried to play this cell using MigraDoc without success. I can add only two texts aligned left and right, but not on the same line.
Here is my code:
Cell cellFooter1 = rowFooter.Cells[0]; Paragraph paraphTot = new Paragraph(); paraphTot.Format.Alignment = ParagraphAlignment.Left; paraphTot.AddText("Left text"); cellFooter1.Add(paraphTot); Paragraph paraphDetails = new Paragraph(); paraphDetails.Format.Alignment = ParagraphAlignment.Right; paraphDetails.AddText("Right text"); cellFooter1.Add(paraphDetails);
Here is a solution ( http://forum.pdfsharp.net/viewtopic.php?f=2&t=2373 ), but I can not do the same with my table. I do not understand how this works.
Edit: Partial Solution:
After hard work, to understand how it works, my code partially works. in part, because the only way I found to align to the right is to create a TabStop with an approximate value ... not very good.
Table table = new Table(); table.Borders.Width = 0.75; Column myColumn = table.AddColumn(Unit.FromCentimeter(7)); Row myRow = table.AddRow(); Cell myCell = myRow.Cells[0]; Paragraph myParagraph = new Paragraph(); Style myStyle = doc.AddStyle("myStyle", "Normal"); myStyle.ParagraphFormat.Font.Size = 6.5; myStyle.ParagraphFormat.Font.Bold = true; myStyle.ParagraphFormat.TabStops.Clear(); myStyle.ParagraphFormat.AddTabStop(Unit.FromMillimeter(67), TabAlignment.Right); myParagraph.Style = "myStyle"; myParagraph.Format.Alignment = ParagraphAlignment.Left; myParagraph.AddFormattedText("left", "myStyle"); myParagraph.AddTab(); myParagraph.AddFormattedText("right", "myStyle"); myCell.Add(myParagraph);
It works, but how to find a good value for the AddTab function? I put 67 because 68to70 is not working.
source share