Telerik Forums
Telerik Document Processing Forum
1 answer
122 views

I am trying to import HTML but when I try to export the radflowdocument it is blank .  (i've exported to both HTML and PDF)

this is in blazor WASM.


Thanks
Phil

Maria
Telerik team
 answered on 18 Nov 2022
1 answer
198 views

I'm using Telerik.Documents.Spreadsheet (2022.3.1108) .Net C# 6.0.  I have my excel spreadsheet formated as I want (Excel.png).  The text in the cells are clearly visible.  Once the same spreadsheet is export using PdfFormatProvider.  The last half a character is trimmed (not visible). (Pdf.png).  While creating the excel file I do have "AutoFitWidth()" set for all the columns.

 

Export Code here


        public void CreatePdf(Workbook wb, string fileName)
        {
            var fixedProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider();
            RadFixedDocument fixedDocument = fixedProvider.ExportToFixedDocument(wb);
                        

            var pdfFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
            pdfFormatProvider.ExportSettings.ShouldEmbedFonts = true;

             using (Stream output = File.OpenWrite($"c:\\temp\\{fileName}.pdf"))
            {
                pdfFormatProvider.Export(fixedDocument, output);
            }
        }

Nikolay Demirev
Telerik team
 answered on 10 Nov 2022
1 answer
182 views

When I convert a document from .docx to .PDF, the footer disappears.  There are a couple checkboxes in the docx that disappear as well.  Does this library support these things?  Is there something specific I have to do to make them work?

 

My code:


                RadFlowDocument document;

                Telerik.Documents.ImageUtils.ImagePropertiesResolver defaultImagePropertiesResolver = new Telerik.Documents.ImageUtils.ImagePropertiesResolver();
                Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.ImagePropertiesResolver = defaultImagePropertiesResolver;

                using (FileStream input = new FileStream("file.bin", FileMode.Create, System.IO.FileAccess.ReadWrite))
                {
                    input.Write(doc.Content, 0, doc.Content.Count());

                    DocxFormatProvider provider = new DocxFormatProvider();
                    document = provider.Import(input);

                    //insert the data
                    RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);

                    foreach (var item in templateValues)
                    {
                        editor.ReplaceText(item.Key, item.Value);
                    }

                    //change the value in the footer
                    editor.ReplaceText("[Document Revised Date]", doc.lastModified.ToShortDateString());

                    PdfFormatProvider pdfProvider = new PdfFormatProvider();
                    var result = pdfProvider.Export(document);

                    return result;

Peshito
Telerik team
 answered on 10 Nov 2022
1 answer
155 views

Hello All,

I am using the RadSpreadStreamProcessing to export data to an Excel spreadsheet and I would like to know how to declare the column headers in the exported spreadsheet as Sortable/Filterable?  Is there an example that I can be pointed to?

Thanks for any help you can provide.

W

Tanya
Telerik team
 answered on 01 Nov 2022
3 answers
118 views

Hi all I have a problem during the import of an existing excel file with formula inside

(e.c.  IF(H1<>"";IF(J1="";"";INDEX(INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE("Var_"&C1&"_"&G1&"_"&H1;" ";"hex20");"-";"hex2d");"(";"hex28");")";"hex29");"/";"hex2f");"+";"hex2b");"&";"hex26");".";"hex2e")&"_Daily");MATCH(J1;INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE("Var_"&C1&"_"&G1&"_"&H1;" ";"hex20");"-";"hex2d");"(";"hex28");")";"hex29");"/";"hex2f");"+";"hex2b");"&";"hex26");".";"hex2e")&"_Levels");0)));""

or

==EOMONTH(startdate;-1)

These formula are used in different cells in different sheets and when I try to bind the generated json to a spreadsheet component I received this error: 

  • {message: 'Expected op «,» but found sym «Var_» (input: _matr…"hex2b");"&";"hex26");".";"hex2e")&"_Service")"))', pos: 139}
    1. message: "Expected op «,» but found sym «Var_» (input: _matrix(\"INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(\"Var_\"&C1;\" \";\"hex20\");\"-\";\"hex2d\");\"(\";\"hex28\");\")\";\"hex29\");\"/\";\"hex2f\");\"+\";\"hex2b\");\"&\";\"hex26\");\".\";\"hex2e\")&\"_Service\")\"))"
    2. pos: 139
    3. [[Prototype]]: H

     

    As posted in some forum  It seems due  to the culture used during excel generation (I tried different approach: attached a different culture to the current thread server side, force kendo core library to use a specific culture client side, force spreadsheet to use a specific culture server side).

    How can I resolved this issue?

    I did not found any working solution on line.

    Thank you in advanced

    Eleonora

Eleonora
Top achievements
Rank 1
Iron
 answered on 27 Oct 2022
1 answer
91 views

Hi Telerik.

Attempting to create a Header with your documentation. Link: Headers and Footers

The example code writes: 

RadFlowDocument document = new RadFlowDocument(); 
document.Sections.AddSection(); 
 
document.Sections.First().Headers.Add(); // Creates the default Header. 
document.Sections.First().Headers.Add(HeaderFooterType.First); 
document.Sections.First().Headers.Add(HeaderFooterType.Even); 

However I get the errorcode:


'object' does not contain a definition for'Headers'and no accessible extension method 'Headers' accepting a first argument of type
 'object'could be found (are you missing a using directive or an assembly reference?) 

Am I doing something wrong?

 

 

Steffen
Top achievements
Rank 1
Iron
 updated answer on 27 Oct 2022
1 answer
127 views
Hello, I would like to convert a Word file (.docx) to a PDF and then display it in the RadPDFViewer.

I have already tested examples here in the forum. However, the PDF file is always empty or corrupt.

Can someone help me there?

The program is written in C#

Thanks in advance
Dimitar
Telerik team
 answered on 25 Oct 2022
1 answer
111 views

I'm doing a recursive file search through a lot of documents (1000000+) for a client, depending on the document type/age/size/name/path the app may read the document.

this is the read code

Dim docprovider As New Doc.DocFormatProvider()
		Using input As Stream = File.OpenRead(_fname)
			Dim TxtFormatProvider As New TxtFormatProvider
			text = TxtFormatProvider.Export(docprovider.Import(input))
		End Using

Occasionally the app will hang waiting for the

TxtFormatProvider.Export(docprovider.Import(input))

Thread to return.

I'm guessing the input stream of the .doc file is malformed in someway, and I'm not really concerned about it, but how can I get the thread to quit so the app can go to the next file?

Dimitar
Telerik team
 answered on 20 Oct 2022
1 answer
175 views

Hello,

we are currently in need for a docx to pdf converter.

The docx file contains placeholders created in word. When we want to read it in with the Telerik documents package it gives us an error. 

The Import() function returns:

Error: System.ArgumentException: 'An item with the same key has already been added. Key: 0'

Here is the code we are using:

        static void ConverDocxToPdf(string path, string resultPath)
        {
            var docxPRovider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
            var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();

            byte[] docBytes = File.ReadAllBytes(path);
            var document = docxPRovider.Import(docBytes);

            var resultBytes = pdfProvider.Export(document);
            File.WriteAllBytes(resultPath, resultBytes);
        }

 

I attached one of the templates we are using. When you try to read it in, it will return the mentioned error.

 

Thank you in advance!

 

Dimitar
Telerik team
 answered on 19 Oct 2022
1 answer
100 views

When using the Clone function from RadFlowDocument, the below exception is thrown :

[2022-10-07T13:06:32.329Z] Error: System.ArgumentException: The document element is associated with another document. (Parameter 'item')
   at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.VerifyDocumentElementOnInsert(T item)
   at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Paragraph.CloneCore(CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Footer.CloneCore(CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.HeadersFootersBase`1.CloneHeadersFootersFrom(HeadersFootersBase`1 headersFooters, CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Section.ClonePropertiesAndHeadersFooters(CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Section.CloneCore(CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.RadFlowDocument.CloneCore(CloneContext cloneContext)
   at Telerik.Windows.Documents.Flow.Model.RadFlowDocument.Clone()
   at Perspex.Shared.OOPGenerator.OOPGenerator.SetWordDocumentTemplate(Schools school, SchoolYear schoolyear) in D:\projecten\cip\Perspex\src\Perspex.Shared\OOPGenerator\OOPGenerator.cs:line 62

It occurs after I upgraded to the latetst version of RAD Document processing. In the previous version it worked as expected.

Steps I take to reproduce the issue :

1) Load a word document
2) Clone the document.

    WordDocumentTemplate = await Storage.GetWordDocumentTemplate(school.Onderwijstype, schoolyear);
    if (WordDocumentTemplate!= null)
    {
      WordDocument = WordDocumentTemplate.Clone(); <-- throws the exception

Dimitar
Telerik team
 answered on 11 Oct 2022
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?