переустановила мигра док, работает сохранение файла в пдф

This commit is contained in:
Елена Бакальская 2024-05-29 21:42:34 +04:00
parent 3f0ea55aad
commit 68c704f47c
3 changed files with 5 additions and 9 deletions

View File

@ -9,7 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" /> <PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.9" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -425,8 +425,10 @@ namespace PolyclinicWebAppSuretor.Controllers
_suretorReportLogic.SaveProceduresToPdfFile(reportBindingModel); _suretorReportLogic.SaveProceduresToPdfFile(reportBindingModel);
// ×òåíèå ñãåíåðèðîâàííîãî ôàéëà // ×òåíèå ñãåíåðèðîâàííîãî ôàéëà
var fileBytes = System.IO.File.ReadAllBytes(reportBindingModel.FileName); //var fileBytes = System.IO.File.ReadAllBytes(reportBindingModel.FileName);
var fileName = "ProceduresReport.pdf"; var fileName = "ProceduresReport.pdf";
var filePath = Path.Combine(Directory.GetCurrentDirectory(), fileName);
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
// Âîçâðàùàåì ôàéë â âèäå ñêà÷èâàåìîãî êîíòåíòà // Âîçâðàùàåì ôàéë â âèäå ñêà÷èâàåìîãî êîíòåíòà
return File(fileBytes, "application/pdf", fileName); return File(fileBytes, "application/pdf", fileName);

View File

@ -1,7 +1,7 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<ReportProceduresViewModel> @model List<ReportProceduresViewModel>
@{ @{
ViewData["Title"] = "ProceduresReport"; ViewData["Title"] = "Отчет по процедурам";
} }
<div class="d-flex flex-column"> <div class="d-flex flex-column">
@ -53,13 +53,9 @@
<td>@item.DateStopProcedure?.ToShortDateString()</td> <td>@item.DateStopProcedure?.ToShortDateString()</td>
<td></td> <td></td>
<td></td> <td></td>
@* <td>@string.Join("<br/>", item.MedicamentSymptom.Select(ms => ms.medicamentName))</td>
<td>@string.Join("<br/>", item.MedicamentSymptom.Select(ms => ms.symptomName))</td> *@
</tr> </tr>
@foreach (var ms in item.MedicamentSymptom) @foreach (var ms in item.MedicamentSymptom)
{ {
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
@ -68,9 +64,7 @@
<td>@ms.medicamentName</td> <td>@ms.medicamentName</td>
<td>@ms.symptomName</td> <td>@ms.symptomName</td>
</tr> </tr>
} }
} }
</tbody> </tbody>
</table> </table>