I was using Telerik 2013 Q1 components and now updated to 2015 Q1. In old I did document in code behind and all looked good.
Header and footer set code:
But now this doesn't work anymore and there are lot of lost space (see pictures).
There are also some problems with table row height. See picture Header, there are tables created same way in header and body but body has some extra on those rows.
Header table to docHeader variable:
And Body document stuff:
How do I set header and footer to specific heigth? And how to set tablerow height so that it is working also in body?
/Harri
Header and footer set code:
section.Footers.Default =
new
Footer() { Body = docFooter };
section.Headers.Default =
new
Header() { Body = docHeader };
section.HeaderTopMargin = 20;
section.FooterBottomMargin = 10
But now this doesn't work anymore and there are lot of lost space (see pictures).
There are also some problems with table row height. See picture Header, there are tables created same way in header and body but body has some extra on those rows.
Header table to docHeader variable:
Table table =
new
Table();
TableRow headerRow1 =
new
TableRow();
headerRow1.Cells.Add(CreateCell(
" "
, cell1Width, 12,
false
, RadTextAlignment.Left, Colors.Black, 1));
headerRow1.Cells.Add(CreateCell(
" "
, cell2Width, 12,
false
, RadTextAlignment.Left, Colors.Black, 1));
headerRow1.Cells.Add(CreateCell(
" "
, cell3Width, 12,
false
, RadTextAlignment.Right, Colors.Black, 1));
headerRow1.Cells.Add(CreateCell(
"Sivu"
, cell4Width, 10,
false
, RadTextAlignment.Right, Colors.Black, 1));
TableCell pageNumCell = CreateCell(
" "
, cell5Width, 10,
false
, RadTextAlignment.Right, Colors.Black, 1);
headerRow1.Cells.Add(pageNumCell);
table.Rows.Add(headerRow1);
TableRow headerRow2 =
new
TableRow();
headerRow2.Cells.Add(CreateCell(
" "
, cell1Width, 12,
false
, RadTextAlignment.Left, Colors.Black, 1));
headerRow2.Cells.Add(CreateCell(
"Lähettäjä"
, cell2Width, 10,
false
, RadTextAlignment.Left, Colors.Black, 1));
headerRow2.Cells.Add(CreateCell(
"Itselaskutus"
, cell3Width, 12,
true
, RadTextAlignment.Right, Colors.Black, 1));
headerRow2.Cells.Add(CreateCell(
"Maksaja"
, cell4Width, 10,
false
, RadTextAlignment.Left, Colors.Black, 1));
headerRow2.Cells.Add(CreateCell(
" "
, cell5Width, 10,
false
, RadTextAlignment.Right, Colors.Black, 1));
table.Rows.Add(headerRow2);
// and so on...
And Body document stuff:
Table tableRecBilInfo =
new
Table();
//otsikot
#region Row1
tableRecBilInfoRow =
new
TableRow();
tableRecBilInfoRow.Height = 20;
tableRecBilInfoCell01 = CreateCell(
" "
, RecBilInfoCell01Width, 10,
false
, RadTextAlignment.Left, Colors.Black);
tableRecBilInfoCell01.Borders =
new
TableCellBorders(
new
Telerik.Windows.Documents.Model.Border(1, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(1, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(0, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(0, BorderStyle.Single, Colors.Black)
);
tableRecBilInfoRow.Cells.Add(tableRecBilInfoCell01);
tableRecBilInfoCell02 = CreateCell(
"Vastaanottaja"
, RecBilInfoCell02Width + RecBilInfoCell03Width, 10,
false
, RadTextAlignment.Left, Colors.Black, 2);
tableRecBilInfoCell02.Borders =
new
TableCellBorders(
new
Telerik.Windows.Documents.Model.Border(0, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(1, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(0, BorderStyle.Single, Colors.Black),
new
Telerik.Windows.Documents.Model.Border(0, BorderStyle.Single, Colors.Black)
);
tableRecBilInfoRow.Cells.Add(tableRecBilInfoCell02);
// and so on ...
How do I set header and footer to specific heigth? And how to set tablerow height so that it is working also in body?
/Harri