Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# itextsharp中的文本正确格式和对齐方式_C#_Css_Itextsharp_Phrase - Fatal编程技术网

C# itextsharp中的文本正确格式和对齐方式

C# itextsharp中的文本正确格式和对齐方式,c#,css,itextsharp,phrase,C#,Css,Itextsharp,Phrase,我使用这段代码将表中的两个短语/两列对齐在一起 table = new PdfPTable(2); table.TotalWidth = 450f; table.LockedWidth = true; float[] widths= new float[] { 100f, 350f }; table.SetWidths(widths); table.WidthPercentage = 85;

我使用这段代码将表中的两个短语/两列对齐在一起

        table = new PdfPTable(2);
        table.TotalWidth = 450f;
        table.LockedWidth = true;
        float[] widths= new float[] { 100f, 350f };
        table.SetWidths(widths);
        table.WidthPercentage = 85;
        table.HorizontalAlignment = Element.ALIGN_LEFT;
        cell = new PdfPCell();
        cell = PhraseCell(new Phrase("Repair 2 - Tongue pig biltong picanha:", newfntbld), PdfPCell.ALIGN_LEFT);
        cell.PaddingTop = 12f;
        table.AddCell(cell);
        cell = PhraseCell(new Phrase("Ham beef ball tip, pastrami sausage ribeye meatloaf salami kielbasa. Ground round bresaola pastrami ham capicola pork belly, tri-tip drumstick. Beef hamburger pork loin bacon doner chuck shank strip steak ham hock meatloaf. Flank meatball swine frankfurter.", newlightfnt), PdfPCell.ALIGN_LEFT);
        cell.PaddingTop = 12f;
        cell.Border = 0;
        table.AddCell(cell);       
我得到了这个结果

但我想这样表现:


表格通常不会提供这种布局。你为什么要把这个塞进桌子里

将其构建为一个段落要容易得多:

Phrase phrase1 = new Phrase("Repair 2 - Tongue pig biltong picanha - ", newfntbld);
Phrase phrase2 = new Phrase("Ham beef ball tip, pastrami sausage ribeye meatloaf salami kielbasa. Ground round bresaola pastrami ham capicola pork belly, tri-tip drumstick. Beef hamburger pork loin bacon doner chuck shank strip steak ham hock meatloaf. Flank meatball swine frankfurter.", newlightfnt);
Paragraph para = new Paragraph();
para.Add(phrase1);
para.Add(phrase2);

我不知道如何使用段落或短语…这就是为什么我使用表格…thnks来共享此代码…我只寻找此类代码。。。