Telerik Forums
Telerik Document Processing Forum
6 answers
633 views

Hello,

I have some code to import a Word-document with MergeFields, than I MailMerge it with some data end export it to a new document.

This works fine, but I also want to fill a table in the document. How can this be done?

I was trying something like this, but this doesn't work ...

Thanks for any help you guys can give!

 

using System.Collections.Generic;
using System.IO;
using Telerik.Windows.Documents.Flow.Model;
using Telerik.Windows.Documents.Flow.FormatProviders.Docx;

public class ProccessDocument
{
    public ProccessDocument()
    {
        RadFlowDocument importDocument = new RadFlowDocument();

        DocxFormatProvider providerIn = new DocxFormatProvider();
        using (Stream input = File.OpenRead("import.docx"))
        {
            importDocument = providerIn.Import(input);
        }

        RadFlowDocument exportDocument = importDocument.MailMerge(GetData());

        DocxFormatProvider providerUit = new DocxFormatProvider();
        using (Stream output = File.OpenWrite("export.docx"))
        {
            providerUit.Export(exportDocument, output);
        }
    }

    private List<Schedule> GetData()
    {
        return new List<Schedule>()
            {
                new Schedule()
                {
                    Name = "John",

                    Items = new List<Item>()
                    {
                        new Item() { Date = "11/5/2016", Subject = "Soccer training" },
                    }
                },
                new Schedule()
                {
                    Name = "Debby",

                    Items = new List<Item>()
                    {
                        new Item() { Date = "10/5/2016", Subject = "Swimming" },
                        new Item() { Date = "12/5/2016", Subject = "Dancing" },
                        new Item() { Date = "15/5/2016", Subject = "Music" },
                    }
                },
            };
    }
}

public class Schedule
{
    public string Name { get; set; }
    public List<Item> Items { get; set; }
}

public class Item
{
    public string Date { get; set; }
    public string Subject { get; set; }
}

Tanya
Telerik team
 answered on 22 Apr 2020
3 answers
802 views
     I need to print document on shared printer from a web page, it's possible print a document?
Rumen
Telerik team
 answered on 17 Apr 2020
1 answer
141 views

     Hello, i use library for manipulate word (RadFlowDocumentEditor) and i need to save file in PDF i use PdfFormatProvider, i use free of 9 font in word for print a barcode, but after i save  in pdf does not print a font with barcode.

what can I do? It's possible include font?

riccardo
Top achievements
Rank 1
 answered on 09 Apr 2020
3 answers
1.1K+ views

Hi,

I am trying to convert a PDF to an image server side in our .Net MVC application.

I have seen this forum post https://www.telerik.com/forums/convert-pdf-to-jpg and it explains how to convert a pdf to an image but those libraries don't seem to be available in an MVC application. 

Is there a solution that I can use for my application?

Martin
Telerik team
 answered on 06 Apr 2020
2 answers
522 views

I have been banging my head on adding a PNG to a PDF.  I can do it with a JPG but no joy with PNG.

public void AddImage(RadFixedDocument document)
{
    FixedContentEditor editor = new FixedContentEditor(document.Pages[0]);
    using (FileStream fs = new FileStream("ADC.jpg", FileMode.Open, FileAccess.Read))
    {
        editor.Position.Translate(50, 50);
        editor.DrawImage(new ImageSource(fs, ImageQuality.High), 50, 50);
    }
}

 

Change the jpg to a png and I get this error:  System.NotSupportedException: 'Can not export other than Jpeg and Jpeg2000 and ImageQuality different than High'

I can change the ImageQuality to low and same error.  Is there an example of DrawImage with a png?

Carlos
Top achievements
Rank 1
 answered on 03 Apr 2020
6 answers
630 views

Hi, I wonder if you can help with my issue

How do you change the weight,  when writing a Microsoft Word document using RadFlowDocumentEditor?

I have a problem when I try to put a bold text, because I get the next error: The name 'FontWeights' does not exist in the current context

The code I'm using is:

 RadFlowDocument document = new RadFlowDocument();
 RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);

editor.InsertLine("PASO 3: Detección de riesgos para el nacimiento").FontWeight =  FontWeights.Bold;  

 

Tanya
Telerik team
 answered on 17 Mar 2020
1 answer
122 views
I'm exporting an list of people where the first column is a photo.

But regarless of changing the width/height the file size stays the same. Is there a way to reduce resolution ?

foreach (DataRow _dr in DS.Tables["PHOTO"].Rows)
          {
              FloatingImage image = new FloatingImage(sheet, new CellIndex(startRow, 0), 0, 0)
              {
                  ImageSource = new ImageSource((byte[])_dr["FOTO_EMPREGADO"], "jpg"),
                  Width = 65,
                  Height = 70
              };
 
              sheet.Shapes.Add(image);
 
              startRow++;
          }
Martin
Telerik team
 answered on 16 Mar 2020
3 answers
130 views
I'd like to know if with the new radWordsProcessing control/routines can be able to

1) load an existing docx.
2) Modify and replace some string and then
3) prepare and download to final user with the modified docx...

I've read all your documentation and I fear that I understand that we can not change the text of the document.
I've seen the merge field... but I don't know if I can put them in template doc ... that ... will be modify ...

This control is excellent ... to create ... but can the final user prepares a lot of templates and then can he use to make custom letters with some data?

merci... and thanks so much

geppo

Now I download the windows ... component... because I understand the need...

:-)

Dimitar
Telerik team
 answered on 05 Mar 2020
1 answer
301 views

 

Hello,

I want to open a docx, find and replace an image in the header and replace another image in the body. How can I achieve that?

Thanks

Dimitar
Telerik team
 answered on 05 Mar 2020
3 answers
142 views

Is this even possible?  I'd like some advice.

I'd like to be able to visually show a document on screen and build each page.  I'd like each page to be a grid with user selected number of columns and rows and be able to drag the borders to change the size.  Then I'd like to be able to drag various UI elements into each grid cell.  If it's possible, is there any Telerik training available for this?

 

Dimitar
Telerik team
 answered on 27 Feb 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?