Telerik Forums
Telerik Document Processing Forum
0 answers
70 views
I am using a PdfFormatProvider to export the stream of a DocX.

I am displayinga preview of this docx as PDF within my application. The problem is, the PDF is not showing the correct spacing, line numbers and other items listed in the docX file.

When I save DocX as PDF it will display everything needed.
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 05 Aug 2024
1 answer
100 views

Hi folks,

we have a requirement for a PDF that we must draw a table with different columns counts and sizes. Our approach is to generate a defined number of cells in a row (18) and merge them appropriately as we need them. Find a test below.

void AddSecondTable(RadFixedPage page)
{
var blackBorder = new Border(1, new RgbColor(0, 0, 0));
var editor = new FixedContentEditor(page);
editor.Position.Translate(Unit.CmToDip(2), Unit.CmToDip(2));
var table = new Table
{
LayoutType = TableLayoutType.AutoFit,
DefaultCellProperties =
{
Padding = new Thickness(5, 5, 5, 5),
Borders = new TableCellBorders(blackBorder, blackBorder, blackBorder, blackBorder)
}
};

for (var rowIndex = 0; rowIndex < 10; rowIndex++)
{
var row = table.Rows.AddTableRow();
for (var cellIndex = 0; cellIndex < 18; cellIndex++)
{
var cell = row.Cells.AddTableCell();
cell.PreferredWidth = Unit.CmToDip(1);
var b = cell.Blocks.AddBlock();
b.InsertText(new FontFamily("Helvetica"), FontStyles.Normal, FontWeights.Normal, $"Cell: {cellIndex}");
}

var firstCell = row.Cells[0];
firstCell.ColumnSpan = 4;
}

editor.DrawTable(table, Unit.CmToDip(18));
}

 

We expect that the first cell be placed over the first four columns, but nothing happens at all. What do we miss here?

Further, we would expect that the next cell starts with cellIndex 4, as the first four (0-3) are “merged”.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Aug 2024
1 answer
76 views

I am generating a RadFlowDocument, and at the end protecting the entire document with a custom password like below..

                editor.Protect("TestPassword");
This works when I open the word document as expected, but when I go in MS Word to UNLOCK the document with my password, I am constantly told the password is incorrect.. Any advise on what I am doing wrong? 
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Jul 2024
1 answer
88 views

Hi there,

I am trying to generate a list on the position of a named bookmark in an template.

The list is generated and looks fine, but is a positioned at the very end of the document.

The code looks very similar to my code for generating a  table on the position of a bookmark, but for a list it does not work.

Does anyone kwows what is going wrong? Is a section always generated at the very end of the document?

Thank for your help!

 

My code:

var bookmark = bookmarks.FirstOrDefault(b => b.Bookmark.Name == "PaymentMilestones");

if (bookmark is not null)
{
editor.MoveToInlineEnd(bookmark.Bookmark.BookmarkRangeStart);

var section = editor.InsertSection();

List list = document.Lists.Add(ListTemplateType.BulletDefault);

if (purchaseOrderPaymentMilestones is not null && purchaseOrderPaymentMilestones.Any())
{
foreach (var purchaseOrderPaymentMilestone in purchaseOrderPaymentMilestones)
{
var paragraph = section.Blocks.AddParagraph();
paragraph.Inlines.AddRun($"{purchaseOrderPaymentMilestone.Percentage.ToString("N0")}% {purchaseOrderPaymentMilestone.PaymentMilestone.FullDescription}");
paragraph.ListId = list.Id;
paragraph.ListLevel = 0;
}
}
}
Yoan
Telerik team
 answered on 22 Jul 2024
1 answer
67 views

Hi I am looking for code to add a table to a template with a bookmark:

The first step in my code is to go to the named bookmark, then I generate the table, but the table is not attached to location of the bookmark, but shows at the very end of the document.

var bookmark = bookmarks.FirstOrDefault(b => b.Bookmark.Name == "PricingTable");
if (bookmark is not null)
{
editor.MoveToInlineEnd(bookmark.Bookmark.BookmarkRangeStart);

Table table = document.Sections.AddSection().Blocks.AddTable();
document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
table.StyleId = BuiltInStyleNames.TableGridStyleId;
foreach (var pricingTableRow in pricingTable)
{
TableRow row = table.Rows.AddTableRow();
foreach (var property in pricingTableRow.GetType().GetProperties())
{
TableCell cell = row.Cells.AddTableCell();
cell.Blocks.AddParagraph().Inlines.AddRun(property.GetValue(pricingTableRow) is null ? string.Empty : property?.GetValue(pricingTableRow)?.ToString());
}
}
}

}

 

 

Yoan
Telerik team
 answered on 18 Jul 2024
1 answer
61 views

Hi,

We've been using the DocFormatProvider and DocxFormatProvider to convert from DOC to DOCX. Most documents convert okay. However, we've noticed some really old documents (late 90's) contain an image (or object) type called PBrush. I'm guessing it's from the old PaintBrush program. Is there any option to keep these when converting?

Thanks

Daniel

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 18 Jul 2024
1 answer
108 views

Here's a trivial example that demonstrates this and the file as well, confused because it works on your "InteractiveForms.pdf" file. The file can be found on the Canadian government site, see link below.

PdfFormatProvider provider = new PdfFormatProvider();
RadFixedDocument document = provider.Import(File.OpenRead("t661-fill-20e.pdf"));

Note that the RadFixedDocument.AcroForm.FormFields will be count of 0 even though there are tons of editable fields ...

The PDF file can be found on the Canadian government website:  See Fillable PDF (t661-fill-20e.pdf) at ...

Site to grab the PDF

Hoping for a miracle ... ;)
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 31 May 2024
2 answers
96 views

Hi,

Table cells with individually set vertical borders lose them when DocxFormatProvider is used for export. Import and export the attached file to see the problem. Does anyone know how to fix this? Pdf export seems to work correctly.

Thanks,
stim

Yoan
Telerik team
 answered on 27 May 2024
1 answer
61 views
I have Telerik UI for WPF and used RadPdfViewerControl. I noticed the below message on UI when rendering PDF file. Is this not included as part of Telerik UI for WPF ? Do I need to purchase a separate license for this ? If so, how much is the commercial license  ?


Dess | Tech Support Engineer, Principal
Telerik team
 answered on 27 May 2024
1 answer
107 views

Hello,

I would like to know if it's possible to retrieve the footnotes of a word document (docx) using RadFlowDocument.

I'm trying to look for examples but I'm not able to find any.

I'm building a solution that needs to parse .docx files and retrieve the footnotes.

I know that with OpenXML format it's possible to read it: FootnotesPart footnotesPart = wordDoc.MainDocumentPart.FootnotesPart;

Any help would be great.

Thanks.

Yoan
Telerik team
 answered on 23 May 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?