Please help me, I wanna generate word document contain bullet and numberring using RadFlowDocumentEditor ? I tried but arrangement is so messi.
if I used section.block, it was success
var paragraph1 = section.Blocks.AddParagraph();
paragraph1.Inlines.AddRun("");
paragraph1.ListId = list.Id;
paragraph1.ListLevel = 0;
001.private void button1_Click(object sender, EventArgs e)002. {003. RadFlowDocument document = new RadFlowDocument();004. //Section section = document.Sections.AddSection(); 005. 006. DocxFormatProvider provider = new DocxFormatProvider();007. RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);008. 009. string reportFilePathDir = Path.Combine(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\")), "OutputTes", "listandtable.docx");010. // Start to Generate Monber Doc011. using (Stream output = new FileStream(reportFilePathDir, FileMode.OpenOrCreate))012. {013. //1. Table014. GenTableInDoc(document, editor);015. 016. 017. //2. list018. List list = document.Lists.Add(ListTemplateType.NumberedDefault);019. 020. var paragraphTop = editor.InsertParagraph();021. paragraphTop.Inlines.AddRun("Note that the numbering the paragraph.");022. 023. var paragraphTop1 = editor.InsertParagraph();024. paragraphTop1.Inlines.AddRun("okeh <p color=\"red\">this is red color</p> <font color=\"red\">This is some text!</font>");025. 026. 027. var paragraph1 = editor.InsertParagraph();028. paragraph1.Inlines.AddRun("Note that the numbering the paragraph.");029. paragraph1.ListId = list.Id;030. paragraph1.ListLevel = 0;031. 032. var paragraph2 = editor.InsertParagraph();033. paragraph2.Inlines.AddRun("Note that the numbering the paragraph.");034. paragraph2.ListId = list.Id;035. paragraph2.ListLevel = 1;036. 037. var paragraph3 = editor.InsertParagraph();038. paragraph3.Inlines.AddRun("Note that the numbering the paragraph.");039. paragraph3.ListId = list.Id;040. paragraph3.ListLevel = 1;041. 042. var paragraph4 = editor.InsertParagraph();043. paragraph4.Inlines.AddRun("Note that the numbering the paragraph.");044. paragraph4.ListId = list.Id;045. paragraph4.ListLevel = 2;046. 047. var paragraphBottom = editor.InsertParagraph();048. paragraphBottom.Inlines.AddRun("Note that the numbering the paragraph.");049. 050. 051. //3. Table052. GenTableInDoc(document, editor);053. 054. //*EXPORT TO WORD055. provider.Export(document, output);056. }057. 058. MessageBox.Show(this, "ok");059. }060. 061. 062.public static void GenTableInDoc(RadFlowDocument document, RadFlowDocumentEditor editor)063. {064. Style style = new Style("ok", StyleType.Table);065. style.CharacterProperties.ForegroundColor.LocalValue = new ThemableColor(System.Windows.Media.Colors.Black);066. style.CharacterProperties.FontWeight.LocalValue = FontWeights.Bold;067. style.CharacterProperties.FontSize.LocalValue = 9;068. 069. document.StyleRepository.Add(style);070. 071. var section = document.Sections.AddSection();072. 073. Table table = editor.InsertTable();074. //Table table = section.Blocks.AddTable();075. table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100);076. 077. document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);078. table.StyleId = BuiltInStyleNames.TableGridStyleId;079. 080. //header081. TableRow rowHeader = table.Rows.AddTableRow();082. rowHeader.RepeatOnEveryPage = true;083. 084. //number cell header085. TableCell cellNumberHeader = rowHeader.Cells.AddTableCell();086. cellNumberHeader.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; cellNumberHeader.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);087. cellNumberHeader.RowSpan = 2; cellNumberHeader.ColumnSpan = 1;088. 089. cellNumberHeader = rowHeader.Cells.AddTableCell();090. cellNumberHeader.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; cellNumberHeader.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);091. cellNumberHeader.RowSpan = 2; cellNumberHeader.ColumnSpan = 1;092. 093. cellNumberHeader = rowHeader.Cells.AddTableCell();094. cellNumberHeader.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; cellNumberHeader.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);095. cellNumberHeader.RowSpan = 1; cellNumberHeader.ColumnSpan = 3;096. 097. cellNumberHeader = rowHeader.Cells.AddTableCell();098. cellNumberHeader.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; cellNumberHeader.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);099. cellNumberHeader.RowSpan = 2; cellNumberHeader.ColumnSpan = 1;100. 101. cellNumberHeader = rowHeader.Cells.AddTableCell();102. cellNumberHeader.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; cellNumberHeader.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);103. cellNumberHeader.RowSpan = 2; cellNumberHeader.ColumnSpan = 1;104. 105. TableRow rowHeader1 = table.Rows.AddTableRow();106. rowHeader1.RepeatOnEveryPage = true;107. 108. TableCell c1 = rowHeader1.Cells.AddTableCell();109. c1.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; c1.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);110. c1 = rowHeader1.Cells.AddTableCell();111. c1.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; c1.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);112. c1 = rowHeader1.Cells.AddTableCell();113. c1.Blocks.AddParagraph().Inlines.AddRun("Header").FontWeight = FontWeights.Bold; c1.Shading.BackgroundColor = new ThemableColor(System.Windows.Media.Colors.LightGray);114. 115. TableRow rowHeader2 = table.Rows.AddTableRow();116. TableCell c2 = rowHeader2.Cells.AddTableCell();117. c2.Blocks.AddParagraph().Inlines.AddRun("");118. c2 = rowHeader2.Cells.AddTableCell();119. c2.Blocks.AddParagraph().Inlines.AddRun("");120. c2 = rowHeader2.Cells.AddTableCell();121. c2.Blocks.AddParagraph().Inlines.AddRun("");122. c2 = rowHeader2.Cells.AddTableCell();123. c2.Blocks.AddParagraph().Inlines.AddRun("");124. c2 = rowHeader2.Cells.AddTableCell();125. c2.Blocks.AddParagraph().Inlines.AddRun("");126. c2 = rowHeader2.Cells.AddTableCell();127. c2.Blocks.AddParagraph().Inlines.AddRun("");128. c2 = rowHeader2.Cells.AddTableCell();129. c2.Blocks.AddParagraph().Inlines.AddRun("");130. }
Hi,,,
I'm using Telerik Winform Q1 2015.
I just generated Excel File using RadSpreadProcessing.
if I used Microsoft Office 2016 in PC, File Excel not Generated normaly (after file excel generated but suddenly that files had been removed automatically).
but the other way if I used Microsoft Office 2007, it's not a problemo.
Please, give me a solution... :)
Regards
Hi,
I import an existing word-doc that contains several bookmarks:
// import word-doc to RadFlowDocumentRadFlowDocument templateDocument = provider.Import(fileMemoryStream);// edit RadFlowDocumentRadFlowDocumentEditor editor = new RadFlowDocumentEditor(templateDocument);
Then I modify the RadFlowDocument (inserting text, tables, ... at certain positions) by using the RadFlowDocumentEditor.
Finally, I need to remove/delete some parts of the document that are between two bookmarks. I have searched the documentation and forums but could not find a way how to do this.
Any help would be appreciated.
Regards, Manu

Hi All,
I need to write custom code for generating the PDF, where i am getting the image in binary format some thing like below. from database.
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATYAAACxCAYAAABOfp...........................
The Image needs to be inserted into BLOCK of RadFixedDocument. I do have the functions like the following , but my question is how to convert the above image format to any one of the parameters below.
block.InsertImage(imageSource);
block.InsertImage(stream);
block.InsertImage(imageSource, size);
block.InsertImage(stream, size);
block.InsertImage(imageSource, width, height);
block.InsertImage(stream, width, height);
Regards,
JP.

Hi,
I've created a word document that I use with WordsProcessing to mail merge. In the document I've had to use tables to be able to get left and right alignments of blocks of text (seems Word's TextBox isn't supported within WordsProcessing?). The tables solution works and allows me to produce a document as per the attached. However, when I try to convert to produced word document to PDF the document comes out with additional borders on the tables (where certain cell borders have been set to none within the word document). The best way to see this is to create a word document with a table of one row with three columns. For the first column make it so that the borders surround the cell (top, left, right bottom). Do the same for the last column. For the second (middle) column remove the top and bottom borders. The document should now show two boxes, one on the left and one on the right (see attached image as an example). Take this Word Document and then convert it to PDF on the demo (https://demos.telerik.com/aspnet-mvc/wordsprocessing/pdf-export). You'll see when comparing the word document and the converted PDF document what the issue is, in that the middle cell of the table renders with the top and bottom border (which is not present in the word document). Is this a limitation of the PDFProcessing? If so is there another way to construct a word document to achieve the same result both for mail merging in WordsProcessing and converting the subsequent document to PDF so that they render as intended?
Many thanks,
Neil

Hello, in an MVC application I need to convert a .docx that contains images into a pdf. My code below works if the docx does not contain an image. If the docx contains an image I get an object reference error when importing the document on this line: document = providerDocx.Import(stream);
RadFlowDocument document = null;
DocxFormatProvider providerDocx = new DocxFormatProvider();
using (FileStream stream = File.Open(@"C:\\test\myWordDoc.docx", FileMode.Open))
{
document = providerDocx.Import(stream);
var providerPdf = new PdfFormatProvider();
Stream outStream = new MemoryStream();
providerPdf.Export(document, outStream);
//Test the conversion:
var fileStream = File.Create(@"C:\\test\myWordDoc.pdf");
outStream.Seek(0, SeekOrigin.Begin);
outStream.CopyTo(fileStream);
fileStream.Close();
}
How can I convert an existing word document with images to a new pdf document?

Hi,
I'm trying to use the RadFlowDocument in order to create a PDF document. I have successfully managed to use the examples provided in the documentation in order to import the body of my HTML into the document, however the examples for the header and footer do not make it clear how I would go about importing HTML in.
Below is the current state of my code. Unfortunately the header comes out as plain text, but the body is successfully processed. Any advise would be greatly received.
public static byte[] GeneratePDF(DocumentTemplate doc)
{
string body = "";
body = doc.DocumentBody;
HtmlFormatProvider provider = new HtmlFormatProvider();
RadFlowDocument rfd = provider.Import(body);
rfd.Sections.AddSection();
Header defaultHeader = rfd.Sections.First().Headers.Add();
Paragraph defaultHeaderParagraph = defaultHeader.Blocks.AddParagraph();
defaultHeaderParagraph.Inlines.AddRun(doc.DocumentHeader);
PdfFormatProvider provider2 = new PdfFormatProvider();
using (MemoryStream output = new MemoryStream())
{
provider2.Export(rfd, output);
return ReadToEnd(output);
}
}

I retrieve a PDF byte array from a web service. How can I use PdfProcessing to display the byte array as a PDF document in a View?
Thanks.
Mike
