แก้ไขการ export docx และ xlsx

This commit is contained in:
Suphonchai Phoonsawat 2023-08-24 12:56:55 +07:00
parent 160ff2abcf
commit a32165d172
2 changed files with 4 additions and 1 deletions

View file

@ -41,6 +41,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="Telerik.Reporting" Version="17.1.23.718" />
<PackageReference Include="Telerik.Reporting.OpenXmlRendering" Version="17.1.23.718" />
</ItemGroup>
<ItemGroup>

View file

@ -87,6 +87,8 @@ namespace BMA.EHR.Report.Service.Controllers
report.DataSource = command;
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
if(exportType == "docx")
deviceInfo["OutputFormat"] = "DOCX";
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
@ -95,7 +97,7 @@ namespace BMA.EHR.Report.Service.Controllers
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
var content = result.DocumentBytes;