If I am using this:
public sealed class Document
{
public Document(string header, string content)
{
Heading = header;
Content = content;
}
public string Heading { get; set; }
public string Content { get; set; }
}
And this collection
public List<
Document
> Documents { get; }
And this document Implementation
public void Create(RadFlowDocument document)
{
var editor = new RadFlowDocumentEditor(document);
foreach (var t in Documents)
{
if (t.Content == null || t.Heading == null) continue;
var section = document.Sections.AddSection();
section.SectionType = SectionType.Continuous;
var paragraph = section.Blocks.AddParagraph();
editor.MoveToParagraphStart(paragraph);
paragraph.StyleId = BuiltInStyleNames.GetHeadingStyleIdByIndex(1);
paragraph.Inlines.AddRun(t.Heading).Paragraph.Inlines.AddRun();
//is it this next line, because I am making a new paragraph?
section.Blocks.AddParagraph().Inlines.AddRun(t.Content);
}
}
Everything generates great, but if I am in Word, and collapse one of t.Heading... The t.Content does not collapse under it. How can I add t.Heading that uses the default word style of 1 (Heading 1) and the text under it use Normal and expand and collapse with the Heading?
Hello All,
I am inserting certain amount of text into a block which is part of a table cell. , Post to that i am checking the size of the table and if it is over to the size of the page height , i am doing a split on the block.
During Debug time , i can observe that the block is split properly but when we check the generated PDF file , we are observing the text to be overflowing in first page. Is this some thing that any one can help me.
Block answerBlock = new Block();
answerBlock.InsertText(Answer);
if (textAreaTable.Measure().Height + > pageHeight - 120)
{
Size setSize = answerBlock.Measure(new Size(450, pageHeight - (120 )));
Block secondBlock = answerBlock.Split();
var mySize = answerBlock.DesiredSize;
var pendingElements = answerBlock.PendingElements;
answerCell.Blocks.Add(answerBlock);
}
Hi folks,
In the code below, how do I set the text colour for text "INVOICE TO" (line 10) to gray? This is using RadFixedDocument.
The Block object's TextProperties has a HighlightColor property but not a Color property.
As you can see in the code below, the block is inside a cell within a table row within a table.
Thanks for any pointers.
Ken
01.
Table addressInfoTable =
new
Table();
02.
addressInfoTable.LayoutType = TableLayoutType.FixedWidth;
03.
TableRow infoToRow = addressInfoTable.Rows.AddTableRow();
04.
TableCell infoToCell = infoToRow.Cells.AddTableCell();
05.
infoToCell.PreferredWidth = 350;
06.
Block infoBlock = infoToCell.Blocks.AddBlock();
07.
infoBlock.HorizontalAlignment = HorizontalAlignment.Left;
08.
// infoBlock.TextProperties.HighlightColor = new RgbColor(0, 0, 255);
09.
// infoBlock.BackgroundColor = new RgbColor(255, 10, 10);
10.
infoBlock.InsertText(
"INVOICE TO"
);
11.
infoBlock.InsertLineBreak();
12.
infoBlock.InsertText(invoice.Payer.FirstName() +
" "
+ invoice.Payer.LastName());
13.
infoBlock.InsertLineBreak();
Hello,
I would like to create a few different pdf-layers during pdf export.
Is it possible to create pdf-layers with PdfProcessing?
sample screen below in attachment:
best regards
Pawel
Hi guys,
I'm trying to add an ImageInLine into header (a classical Logo Company).
I would keep aspect ratio of my bitmap, but after export to word, it takes not effects.
I tryed to change PreferRelativeToOriginalResize to true and to false, when I try to open properties of image (into generated word file), I found this propertiy correctly changed.
But if I try to do same approach with LockAspectRatio to true and to false, It's ever false. Why?
This is my code to test.
I attached 4 test bitmap, 2 for PreferRelativeToOriginalResize (correctly results) and 2 for LockAspectRatio (wrong results)
editor.Document.HasDifferentEvenOddPageHeadersFooters =
false
;
var header = editor.Document.Sections.First().Headers.Add();
var image = header.Blocks.AddParagraph().Inlines.AddImageInline();
using
(FileStream fs = File.Open(@
"Resources\mylogo.jpg"
, FileMode.Open))
{
image.Image.ImageSource =
new
Telerik.Windows.Documents.Media.ImageSource(fs,
".jpg"
);
//image.Image.PreferRelativeToOriginalResize = false;
image.Image.LockAspectRatio =
true
;
//image.Image.SetWidth(true, 40);
}
How to get the text of BookMarks into a string variable. Following is my code.
#region Get Book Mark Data
public void GetTextFromBookMarks(RadFlowDocument document)
{
IEnumerable<BookmarkRangeStart> bookmarkStart = document.EnumerateChildrenOfType<BookmarkRangeStart>();
IEnumerable<BookmarkRangeEnd> bookmarkEnd = document.EnumerateChildrenOfType<BookmarkRangeEnd>();
foreach (var item in bookmarkStart)
{
}
}
#endregion
Hello,
Could you please provide me an example or redirect me to a demo where pdf is created from stratch and/or pdf exported from the html input. We currently convert data populated WebForm pages into PDF files all on the server that are never delivered to a user via browser interaction, or even requested by a browser (automated generation.). Aside from an HTML source being easier to use and maintain, it would plug right into our existing situation and not require use to reconstruct our forms in C#.
Thanks.
In my docx document I have a bookmark named: "SomeBookMark". "SomeBookMark" was created in msword while "SomeText" was selected.
In the telerik flowdocuments this would mean that BookmarkRangeStart would be placed before "SomeText" and BookmarkRangeEnd would be placed at the end of "SomeText".
I'm able to delete the bookmark and I am able to insert text before or after "SomeText". But effectively I would like to remove "SomeText" and insert my own text. I can see the text in the "inlines" of the paragraph that contains the bookmarks and the text but the way the inlines are populated depends heavily on how the word document was edited. From the word document it would look like "SomeText" was 1 inline entry but it might actually be more than 1.
Is there any generic way to use the bookmarks to select the range of text between the start and end and replace or delete it?