string strDocx = _env.WebRootPath + "\\reports\\CV.docx";
FileInfo fileInfoMain = new FileInfo(strDocx);
if (fileInfoMain.Exists)
{
FileStream fileStream = fileInfoMain.Open(FileMode.Open, FileAccess.Read);
using StreamReader reader = new StreamReader(fileStream);
strDocx = await reader.ReadToEndAsync().ConfigureAwait(true);
await fileStream.DisposeAsync().ConfigureAwait(true);
}
strDocx = strDocx.Replace(Environment.NewLine, string.Empty, StringComparison.InvariantCulture);
Asset myAsset = new jsreport.Types.Asset();
myAsset.Content = strDocx;
jsreport.Types.Report report = await _jsReportMvcService.RenderAsync(new RenderRequest()
{
Template = new Template
{
Engine = Engine.Handlebars,
Recipe = Recipe.Docx,
Docx = new Docx {
TemplateAsset = myAsset
}
},
Data = null
})
.ConfigureAwait(true);
string strDocx = _env.WebRootPath + "\\reports\\CV.docx";
FileInfo fileInfoMain = new FileInfo(strDocx);
if (fileInfoMain.Exists)
{
FileStream fileStream = fileInfoMain.Open(FileMode.Open, FileAccess.Read);
using StreamReader reader = new StreamReader(fileStream);
strDocx = await reader.ReadToEndAsync().ConfigureAwait(true);
await fileStream.DisposeAsync().ConfigureAwait(true);
}
byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes(strDocx);
string strDocTemplate = Convert.ToBase64String(plainTextBytes);
jsreport.Types.Report report = await _jsReportMvcService.RenderAsync(new RenderRequest()
{
Template = new Template
{
Engine = Engine.Handlebars,
Recipe = Recipe.Docx,
Docx = new Docx
{
TemplateAsset = new Asset
{
Encoding = "base64",
Content = strDocTemplate
}
}
},
Data = new
{
message = "Hello world"
}
})
.ConfigureAwait(true);
rs.StartAsync().Wait();
services.AddJsReport(rs);
/F4 9 Tf
1 0 0 -1 11 18 Tm
<0037004b004c005600030056004b00520058004f00470003004500480003004900520051005700100056004c005d00480003001c> Tj
ET