How can I format a set of ranges in a worksheet as a table using document processing?
I couldn't find any source to this matter.
I have attached a screenshot of the Excel function is needed to the desired result.
Hi there,
I am using the trial version at the moment to see if Telerik's document processing can replace another library we are currently using.
Here is our scenario,
We have a Word template document that has merge fields already setup and tables with borders already setup. This word template is read from a database table column into a memory stream and then we use the DocxFormatProvider to import the document to the RadFlowDocument. Below you can see a piece of the template document already setup.
When using EnumerateChildrenOfType<Table>().ElementAt(1) for example I can see that the table is selected and I can see that the border values have been picked up from the word template document. Below inspecting object for the table selected from the template document.
We then perform our mail merge and then use PdfFormatProvider to convert the merge result into a PDF document. The result is that the mail merge fields are merged correctly but all the tables have lost there borders that the original word template document had.
I have tried to after using EnumerateChildrenOfType<Table>().ElementAt(1) to set the border again manually with new TableBorders(new Border(2, Telerik.Windows.Documents.Flow.Model.Styles.BorderStyle.Dotted, new ThemableColor(Colors.Black))); This also does not work.
Here is the PDF result produced, any suggestions would be appreciated. (Also a note, even if I take out mail merge in the process, the document converting straight from Word Template to PDF still produces the tables with no borders...)
Another note when I use your demo link and load my template and export to PDF the borders are also missing. (Telerik Export to PDF)
Hi
I have been able to merge PDFs files all together into a single document by using File.OpenRead to read into a PdfFIleSource and then use the PdfStreamWriter WritePage method to concatenate them all.
But now I want to scale down the pages to be able to add page numbering.
I haven't been able to use scale down (reduce) using the previous method.
I have found another mechanism (https://www.telerik.com/forums/scaling-pdf-document) that is reading the input pages into a RadFixedDocument before adding them with WritePage to the PdfStreamWriter. This works (page are reduced as I want) but when input PDFs are annoted (textboxes or images), the annotations are not added to the scaled down output.
Do you have a sample that is doing that (merge scale down input files while keeping annotations)?
Hi!
How can I make a custom font work, when importing a HTML string and printing it to pdf? Im loosing the "ÄÖÜ" characters currently and know that this is a font related issue.
var htmlDocument = new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
// Regular Font
byte[] fontData = System.IO.File.ReadAllBytes("fonts/verdana.ttf");
Telerik.Documents.Core.Fonts.FontFamily fontFamily = new Telerik.Documents.Core.Fonts.FontFamily("CustomVerdana");
FontsRepository.RegisterFont(fontFamily, FontStyles.Normal, FontWeights.Normal, fontData);
var doc = htmlDocument.Import("<html><body style=\"font-family:CustomVerdana;\">Das ist ein test. <br> <strong>ÖOÜUÄA</strong></body></html>");
var fileName = "output.pdf";
var pdf = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
using (Stream output = System.IO.File.OpenWrite(fileName))
{
pdf.Export(doc, output);
}
Hi ,
I cannot figure out how to add an invisible signature to an existing PDF.
My test code:
var pdfIn = "C:\\Prg\\Test\\TestTelerikPDF\\pdf\\demo.pdf";
var pdfSigned = $"{pdfIn}.sign.pdf";
var pfx = "C:\\Prg\\Test\\TestTelerikPDF\\pdf\\Cert.pfx";
using (var input = new FileStream(pdfIn, FileMode.Open, FileAccess.Read))
{
var document = new PdfFormatProvider().Import(input);
var certificate = new X509Certificate2(pfx, "passs");
var signatureField = new SignatureField("Blabla");
signatureField.Signature = new Signature(certificate);
document.AcroForm.FormFields.Add(signatureField);
var settings = new PdfExportSettings();
settings.ComplianceLevel = PdfComplianceLevel.PdfA3B;
var formatProvider = new PdfFormatProvider();
formatProvider.ExportSettings = settings;
using (var ms = new FileStream(pdfSigned, FileMode.Create))
formatProvider.Export(document, ms);
}
This code create an output PDF but the signature is missing :-(
Can you help me please?
Best
Kamil
Hi,
some of those are briefly mentioned in the docs, others have been subject in previous requests in this forum. Nevertheless, I could not succeed doing these things. It is really hard to describe what i want properly, but i try my best:
- I want the content to take more space of the A4 page, means i want to crop away some of the white space of the top, right, bottom and left to make more room for the content.
- I want a table to take up 100% of the page's height and then in one column have one text block to be positioned at the top and another text block at the bottom. Similar to using flexbox in css and have it "justify-content: space-between", see the "text block" elements in the attached jpeg
- I need page numbers on each page. This was requested a number of times, but it seems like it was still not implemented. Is this correct? What is the best way to do this in 2023? see the numbers at the bottom in the jpeg
- I want to add a repeating page header to each page. see the Repeating Heading element in the jpeg
I created a rough layout design, which is attached as jpeg. Imagine the layout to be a table with currently one row and two columns.
I also took the current c# code and attached it.
I want to import pdf document to a RadFlowWordDocument in the current Run from code.
Is it possible? I have imported pdf using RadEditor.
Basically i am trivarsing whole word document template and updating the text of merge field run.
But after updating the text i want to delete the merge field. How to do that?
var currentDocument = document.EnumerateChildrenOfType<DocumentElementBase>().ToList();
int indexElement = 0;
foreach (var currentElement in currentDocument)
{
if (currentElement.GetType() == typeof(Run))
{
currentRun = (Run)currentElement;
if (currentRun.Text.StartsWith("«") && currentRun.Text.Length > 2)
{
string runText= currentRun.Text.Substring(1, currentRun.Text.Length - 2);
if(runText == "name")
currentRun.Text = "faraz";
}
Now after updating the text i want to delete the merge field and maintain the run text. How to do that?
I'm using RadFlowDocument editor to insert a document in a specific position after a text from run.
So flow is read a document runs and when a text is reach insert another RawFlowDocument in it.
But the problem is always adding it in the end.
I want to insert it at specific position.
There are total 3 documents that needs to be added at specific position.
The run text shows i am at the right position but the generated document always shows new document in the end.
I'm using RadFlowDocument to edit a document (docx), this file is a combination of different docx file.
I have to add Table of content in this file. I saw this code but it is using RadDocument instead of RadFlowDocument class
RadDocument document = new RadDocument(); RadDocumentEditor editor = new RadDocumentEditor(new RadDocument()); editor.InsertField(new TableOfContentsField(), FieldDisplayMode.Result);
How can I add ToC using RadFlowDocument ?
Thanks