This is a migrated thread and some comments may be shown as answers.

How to fit the TableCell width to its content width?

0 Answers 98 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Art
Top achievements
Rank 1
Art asked on 13 Oct 2015, 05:16 PM

I'm trying to create the label cell (two column layout). But it occupies 50% of the table width.

var table = new Table
{
    CellPadding = new Padding(0),
    PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100),
};

Row:

var bodyRow = new TableRow();
 
if (columnCount == 2)
{
    bodyRow.Cells.Add(new TableCell
    {
        Blocks =
        {
            new Paragraph
            {
                Inlines =
                {
                    new Span
                    {
                        FontSize = Settings.LeftLabel.FontSize,
                        FontWeight = FontWeights.Bold,
 
                        Text = Settings.LeftLabel.Text
                    }
                }
            }
        },
 
        PreferredWidth = new TableWidthUnit(TableWidthUnitType.Auto)
    });
}
 

A good solution would be to reduce the size of the cell without word breaking.

The table is not attached to the document, and does not know its real size while builds.​

No answers yet. Maybe you can help?

Tags
RichTextBox
Asked by
Art
Top achievements
Rank 1
Share this question
or