NoWar
NoWar

Reputation: 37633

Set value of a cell of the FlowDocument Table

I need to insert

  var f = new Floater
                            {
                                Padding = new Thickness(0, 0, 0, 0),
                                Margin = new Thickness(0, 0, 5, 0),
                                HorizontalAlignment = HorizontalAlignment.Left,
                                Width = 210
                            };

into the table cell

var table = myFlowDocument.Document.Blocks.FirstBlock as Table;

table.RowGroups[0].Rows[0].Cells[0].SetValue(???);

And really cannot figure our how to do it.

Also it is unclear how to clean the cell.

Any clue?

Thank you!

(This link and this link about are not helping...)

Upvotes: 2

Views: 1031

Answers (1)

Julien Roncaglia
Julien Roncaglia

Reputation: 17837

See the documentation for the Blocks property on MSDN :

var cell = table.RowGroups[0].Rows[0].Cells[0];

// Clear the content
cell.Blocks.Clear();

// Add some text
cell.Blocks.Add(new Paragraph(new Run("Hello world")));

// Add a floater
cell.Blocks.Add(new Paragraph(new Floater()));

Upvotes: 1

Related Questions