Hi,
I need help to setup page orientation to landscape due to size of the contents in cells.
Here is my code.
public RadFlowDocument CreateDocument(ref RadFlowDocument document, List<LetterGenerateData> initltr, string pathlogo)
{
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
Stream stream = File.Open(pathlogo, FileMode.Open);
using (stream)
{
Telerik.Windows.Documents.Media.ImageSource image = new Telerik.Windows.Documents.Media.ImageSource(stream, "png");
editor.InsertImageInline(stream, "png", new System.Windows.Size(168, 48));
}
var codeFont = new ThemableFontFamily(new System.Windows.Media.FontFamily("Arial"));
editor.CharacterFormatting.FontFamily.LocalValue = codeFont;
editor.CharacterFormatting.FontWeight.LocalValue = FontWeights.Bold;
editor.CharacterFormatting.FontSize.LocalValue = 12.0;
editor.InsertText("Statement");
document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
editor.TableFormatting.StyleId = BuiltInStyleNames.TableGridStyleId;
var table = editor.InsertTable();
var headerrow = table.Rows.AddTableRow();
headerrow.RepeatOnEveryPage = true;
var hcell1 = headerrow.Cells.AddTableCell();
hcell1.Blocks.AddParagraph().Inlines.AddRun("Name").FontWeight = FontWeights.Bold;
var hcell2 = headerrow.Cells.AddTableCell();
hcell2.Blocks.AddParagraph().Inlines.AddRun("Profession").FontWeight = FontWeights.Bold;
var hcell3 = headerrow.Cells.AddTableCell();
hcell3.Blocks.AddParagraph().Inlines.AddRun("Age").FontWeight = FontWeights.Bold;
foreach (var item in initltr)
{
var row = table.Rows.AddTableRow();
var cell1 = row.Cells.AddTableCell();
var cell2 = row.Cells.AddTableCell();
var cell3 = row.Cells.AddTableCell();
cell1.Blocks.AddParagraph().Inlines.AddRun(item.Name).FontSize = 9;
cell2.Blocks.AddParagraph().Inlines.AddRun(item.Profession).FontSize = 9;
cell3.Blocks.AddParagraph().Inlines.AddRun(item.Age).FontSize = 9;
}
return document;
}
Much appreciated.