Code:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Aspose.Words;
using Aspose.Words.Reporting;
namespace Aspose.Words.Examples.CSharp.LINQ
{
public class Data
{
public string Name { get; } = "Daudet, Alphonse";
}
class HelloWorld
{
public static void Run()
{
// ExStart:HelloWorld
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LINQ();
Stopwatch stopwatch = Stopwatch.StartNew();
string fileName = "TestDocument01.docx";
// Load the template document.
Document doc = new Document(dataDir + fileName);
// Create an instance of sender class to set it’s properties.
// Sender sender = new Sender {Name = "LINQ Reporting Engine", Message = "Hello World"};
Data data = new Data();
// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();
// Execute the build report.
engine.BuildReport(doc, data, "data");
dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
// Save the finished document to disk.
// doc.Save(dataDir);
doc.Save(dataDir + ".pdf", SaveFormat.Pdf);
Console.WriteLine(stopwatch.Elapsed);
// ExEnd:HelloWorld
Console.WriteLine("\nTemplate document is populated with the data about the sender.\nFile saved at " + dataDir);
}
}
}
As you can see the font in the pdf file is not the same as the one in the docx file. What’s missing and what can I do to have it export the font properly?
Note that I have to use the ReportingEngine because the final program will have to fill-in data in the document and export it to word and pdf.
Thanks