.net 1.1

Hi,

im trying to create a document from a template .dot file

I have 2 bookmarks, the 1st is fine, the 2nd however is not functioning as expected.

It is inserting the table to the top of the page, overlaying the other content. I thought it could be to do with the size and i’ve tried all combinations of the AllowAutoFit and AllowBreakAcrossPages options. I have read the documentation and I can’t see anything wrong with my code hopefully you can give me some guidance. thanks.

This is the code that inserts the table into the 2nd bookmark ( “DATA_START” ):

if (MasterBuilder.MoveToBookmark(“DATA_START”)) {
Aspose.Words.Table table = MasterBuilder.StartTable();

string[] indexes = filterResults.Text.Split(’|’);

// create header font
Aspose.Words.Font font = MasterBuilder.Font;
font.Size = 12;
font.Bold = true;
font.Color = Color.White;
font.Name = “Calibri”;
font.Underline = Aspose.Words.Underline.None;

// insert the header
foreach(TableHeaderCell th in listview.Rows[0].Cells) {
Label label = th.Controls[0] as Label;
if (label != null) {
MasterBuilder.InsertCell();
MasterBuilder.Write(label.Text);
}
}

MasterBuilder.EndRow();

// format the header row
table.FirstRow.RowFormat.AllowAutoFit = false;
table.FirstRow.RowFormat.AllowBreakAcrossPages = true;

foreach(Aspose.Words.Cell cell in table.FirstRow.Cells) {
cell.CellFormat.Shading.BackgroundPatternColor = Color.Green;
}

// create content font
font.Size = 11;
font.Color = Color.Black;
font.Bold = false;

// insert the visible content
for (int i = 0; i < indexes.Length; i++) {
index = Convert.ToInt32(indexes[i]);
row = listview.Rows[index];

foreach(TableCell td in row.Cells) {
Label label = td.Controls[0] as Label;
if (label != null) {
MasterBuilder.InsertCell().CellFormat.WrapText = true;
MasterBuilder.Write(label.Text);
}
}
MasterBuilder.EndRow();
}

MasterBuilder.EndTable();
}

Nevermind, I have fixed it by putting the bookmark inside a 1x1 table.

Hi,


Thanks for your inquiry. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,