{"id":353,"date":"2023-10-10T15:53:46","date_gmt":"2023-10-10T12:53:46","guid":{"rendered":"https:\/\/kb.astrocroc.com\/?p=353"},"modified":"2023-12-21T17:32:32","modified_gmt":"2023-12-21T14:32:32","slug":"excel-%d0%b2-pdf","status":"publish","type":"post","link":"https:\/\/kb.astrocroc.com\/?p=353","title":{"rendered":"Excel \u0432 PDF"},"content":{"rendered":"\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438\u0437 NuGet DJExt.Aspose.Cells<\/p>\n\n\n\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u044f\u043c \u043d\u0430 \u043b\u0435\u0442\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 EPPlusFree package \u0432 PDF:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-cs\" data-line=\"\">\/\/ \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c EXCEL -&gt; PDF\nStream stream = new MemoryStream(package.GetAsByteArray());\nvar workbook = new Workbook(stream);\n\nMemoryStream ms = new MemoryStream();\nworkbook.Save(ms, SaveFormat.Pdf);\nms.Seek(0, SeekOrigin.Begin);\n\nbyte[] buffer = new byte[(int)ms.Length];\nbuffer = ms.ToArray();\n\n\/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c PDF\nPage.Response.Clear();\nPage.Response.ClearContent();\nPage.Response.ClearHeaders();\nPage.Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=DMS_&quot;+ currentItem.ID.ToString() +&quot;_&quot; + ((DateTime)currentItem[&quot;CreationDate&quot;]).ToString(&quot;dd_MM_yyyy&quot;) + &quot;.pdf&quot;);\n\/\/Set the content type as file extension type  \nPage.Response.ContentType = &quot;pdf&quot;;\n\/\/Write the file content  \nPage.Response.BinaryWrite(buffer);\nPage.Response.End();<\/code><\/pre>\n\n\n\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430:<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-c83bba24-fc10-4773-89b2-194e62be998f\" href=\"https:\/\/kb.astrocroc.com\/wp-content\/uploads\/2023\/10\/Aspose.Cells_.zip\">Aspose.Cells<\/a><a href=\"https:\/\/kb.astrocroc.com\/wp-content\/uploads\/2023\/10\/Aspose.Cells_.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-c83bba24-fc10-4773-89b2-194e62be998f\">\u0421\u043a\u0430\u0447\u0430\u0442\u044c<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438\u0437 NuGet DJExt.Aspose.Cells \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u044f\u043c \u043d\u0430 \u043b\u0435\u0442\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 EPPlusFree package \u0432 PDF: \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430:<\/p>\n","protected":false},"author":1,"featured_media":354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3,9],"tags":[62,42],"class_list":["post-353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint","category-web","category-web-forms","tag-excel-to-pdf","tag-pdf"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353"}],"version-history":[{"count":3,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":391,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/posts\/353\/revisions\/391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=\/wp\/v2\/media\/354"}],"wp:attachment":[{"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.astrocroc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}