{"id":208948,"date":"2014-01-14T09:06:02","date_gmt":"2014-01-14T05:06:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=208948"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=208948","title":{"rendered":"<span class=\"post_title\">\u0423\u043b\u0443\u0447\u0448\u0430\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 Excel \u0434\u043b\u044f SharePoint<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 Excel \u0432 SharePoint \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 SharePoint \u043e\u0442\u0434\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f Excel, \u0438 \u0443\u0436\u0435 \u0441\u0430\u043c Excel \u0437\u0430\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Excel \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u041d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\u041d\u0443\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Excel \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <\/li>\n<li>\u0412 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f InternalName \u043f\u043e\u043b\u0435\u0439. <\/li>\n<li>\u0412 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u201c\u0441\u044b\u0440\u043e\u0439\u201d \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442.<\/li>\n<\/ul>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u0441\u0432\u043e\u044e \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u044f\u0442.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041f\u043e\u0434\u043c\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043e\u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 Ribbon \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 <code>CommandUIDefinition<\/code> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>Location<\/code> \u0440\u0430\u0432\u043d\u044b\u043c Id \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0412\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\&lt;b&gt;14&lt;\/b&gt;\\TEMPLATE\\GLOBAL\\XML\\CMDUI.XML<\/code> \u0434\u043b\u044f SharePoint 2010 (\u0438\u043b\u0438 <b>15<\/b> \u0434\u043b\u044f SharePoint 2013).<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 Excel \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441 Id \u0440\u0430\u0432\u043d\u044b\u043c\u0438 <code>Ribbon.List.Actions.ExportToSpreadsheet<\/code> \u0438 <code>Ribbon.Library.Actions.ExportToSpreadsheet<\/code> \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>Location<\/code> \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u0442\u0438 Id.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;CommandUIDefinitions&gt;   &lt;CommandUIDefinition     Location=&quot;Ribbon.Library.Actions.ExportToSpreadsheet&quot;&gt;     &lt;Button Id=&quot;Ribbon.Library.Actions.ExportToSpreadsheet-Replacement&quot;       Sequence=&quot;40&quot;       Command=&quot;ExportToSpreadsheet-Replacement&quot;             Image16by16=&quot;\/_layouts\/$Resources:core,Language;\/images\/formatmap16x16.png&quot; Image16by16Top=&quot;-152&quot; Image16by16Left=&quot;-32&quot;       Image32by32=&quot;\/_layouts\/$Resources:core,Language;\/images\/formatmap32x32.png&quot; Image32by32Top=&quot;-352&quot; Image32by32Left=&quot;0&quot;       LabelText=&quot;$Resources:core,cui_ButExportToSpreadsheet;&quot;       ToolTipTitle=&quot;$Resources:core,cui_ButExportToSpreadsheet;&quot;       ToolTipDescription=&quot;$Resources:core,cui_STT_ButExportListToSpreadsheet;&quot;       TemplateAlias=&quot;o2&quot;         \/&gt;   &lt;\/CommandUIDefinition&gt;   &lt;CommandUIDefinition     Location=&quot;Ribbon.List.Actions.ExportToSpreadsheet&quot;&gt;     &lt;Button Id=&quot;Ribbon.List.Actions.ExportToSpreadsheet-Replacement&quot;       Sequence=&quot;40&quot;       Command=&quot;ExportToSpreadsheet-Replacement&quot;       Image16by16=&quot;\/_layouts\/$Resources:core,Language;\/images\/formatmap16x16.png&quot; Image16by16Top=&quot;-152&quot; Image16by16Left=&quot;-32&quot;       Image32by32=&quot;\/_layouts\/$Resources:core,Language;\/images\/formatmap32x32.png&quot; Image32by32Top=&quot;-352&quot; Image32by32Left=&quot;0&quot;       LabelText=&quot;$Resources:core,cui_ButExportToSpreadsheet;&quot;       ToolTipTitle=&quot;$Resources:core,cui_ButExportToSpreadsheet;&quot;       ToolTipDescription=&quot;$Resources:core,cui_STT_ButExportListToSpreadsheet;&quot;       TemplateAlias=&quot;o1&quot;         \/&gt;   &lt;\/CommandUIDefinition&gt; &lt;\/CommandUIDefinitions&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f \u0441 <code>Id=&quot;Ribbon.Calendar.Calendar.Actions.ExportToSpreadsheet&quot;<\/code>, \u0441 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430<\/h4>\n<p>  \u041a\u043d\u043e\u043f\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0435, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c <i>DelegateControl<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 <code>Id=&quot;AdditionalPageHead&quot;<\/code>:  <\/p>\n<pre><code class=\"xml\">&lt;Control    Id=&quot;AdditionalPageHead&quot;   Sequence=&quot;1000&quot;   ControlAssembly=&quot;$SharePoint.Project.AssemblyFullName$&quot;    ControlClass=&quot;$SharePoint.Type.7fd7c6f0-4eda-48ce-ac8f-aa9f9d2666ac.FullName$&quot;\/&gt; <\/code><\/pre>\n<p>  \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <i>PostBack<\/i>, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043d\u0430\u0448\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u043c. \u041a\u043d\u043e\u043f\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430, \u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a\u0430\u043a \u0432\u0435\u0431-\u0447\u0430\u0441\u0442\u0438, \u0442\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c Id \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  \u0423\u0432\u044b, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 Id \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u0430 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u2013 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0443\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 Id \u0441\u043f\u0438\u0441\u043a\u0430.<\/p>\n<pre><code class=\"xml\">&lt;CommandUIHandlers&gt;   &lt;CommandUIHandler     Command=&quot;ExportToSpreadsheet-Replacement&quot;     CommandAction=&quot;javascript:(function(){var x=SP.ListOperation.Selection.getSelectedList(); if (x) {__doPostBack('ExportToSpreadsheet-Replacement', x);}})();&quot; \/&gt; &lt;\/CommandUIHandlers&gt; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0430 \u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435:<\/p>\n<pre><code class=\"cs\">protected override void OnLoad(EventArgs e) {      if (this.Page.Request[&quot;__EVENTTARGET&quot;] == &quot;ExportToSpreadsheet-Replacement&quot;)      {         var spContext  = SPContext.Current;         SPList list;         SPView view;          if (spContext.ViewContext.View != null)         {             list = spContext.List;             view = spContext.ViewContext.View;         }         else         {             var listId = new Guid(this.Page.Request[&quot;__EVENTARGUMENT&quot;]);             var web = spContext.Web;             list = web.Lists[listId];             view = list.DefaultView;         }          ExportData(list.Title + &quot; - &quot; + view.Title, GetDataTable(list, view));     }  } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">private static System.Data.DataTable GetDataTable(SPList list, SPView view) {     var query = new SPQuery(view);     SPListItemCollectionPosition position;     var flags = SPListGetDataTableOptions.UseBooleanDataType | SPListGetDataTableOptions.UseCalculatedDataType;     var result = list.GetDataTable(query, flags, out position);     while (position != null)     {         list.AppendDataTable(query, flags, result, out position);     }     return result; } <\/code><\/pre>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f Excel \u0444\u0430\u0439\u043b\u0430<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c Excel \u0444\u0430\u0439\u043b \u0438 \u043e\u0442\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Excel \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 ClosedXml (<a href=\"http:\/\/closedxml.codeplex.com\/\">http:\/\/closedxml.codeplex.com\/<\/a>).<\/p>\n<pre><code class=\"cs\">private void ExportData(string title, System.Data.DataTable table) {     var wb = new XLWorkbook();     var ws = wb.Worksheets.Add(title);     ws.Cell(1, 1).InsertTable(table);      var response = this.Page.Response;     response.Clear();      response.ContentType = &quot;application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;;     var filename = title+&quot;.xlsx&quot;;     response.AddHeader(&quot;content-disposition&quot;, GetContentDisposition(filename));      \/\/ Flush the workbook to the Response.OutputStream     using (var memoryStream = new MemoryStream())     {         wb.SaveAs(memoryStream);         memoryStream.WriteTo(response.OutputStream);     }     response.End(); } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 Excel \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 (\u0441\u043f\u0430\u0441\u0438\u0431\u043e ClosedXml), \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2013 \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<p>  \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u0442\u0432\u0435\u0442\u0430 <code>content-disposition<\/code> \u043e\u0447\u0435\u043d\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u0440\u0443\u0441\u0441\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0430\u043d\u0446\u0435\u0432 \u0441 \u0431\u0443\u0431\u043d\u043e\u043c.<\/p>\n<p>  \u041a\u043e\u0434 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 <code>content-disposition<\/code> \u044f \u043d\u0430\u0448\u0435\u043b \u043d\u0430 StackOverflow <a href=\"http:\/\/stackoverflow.com\/questions\/93551\/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http\">stackoverflow.com\/questions\/93551\/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http<\/a><\/p>\n<pre><code class=\"cs\">private string GetContentDisposition(string filename) {     var request = this.Page.Request;     string contentDisposition;      if (request.Browser.Browser == &quot;IE&quot; && (request.Browser.Version == &quot;7.0&quot; || request.Browser.Version == &quot;8.0&quot;))         contentDisposition = &quot;attachment; filename=&quot; + Uri.EscapeDataString(filename);     else if (request.UserAgent != null && request.UserAgent.ToLowerInvariant().Contains(&quot;android&quot;)) \/\/ android built-in download manager (all browsers on android)         contentDisposition = &quot;attachment; filename=\\&quot;&quot; + MakeAndroidSafeFileName(filename) + &quot;\\&quot;&quot;;     else         contentDisposition = &quot;attachment; filename=\\&quot;&quot; + filename + &quot;\\&quot;; filename*=UTF-8''&quot; + Uri.EscapeDataString(filename);     return contentDisposition; }  private static readonly Dictionary&lt;char, char&gt; AndroidAllowedChars = &quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-+,@\u00a3$\u20ac!\u00bd\u00a7~'=()[]{}0123456789&quot;.ToDictionary(c =&gt; c); private string MakeAndroidSafeFileName(string fileName) {     char[] newFileName = fileName.ToCharArray();     for (int i = 0; i &lt; newFileName.Length; i++)     {         if (!AndroidAllowedChars.ContainsKey(newFileName[i]))             newFileName[i] = '_';     }     return new string(newFileName); } <\/code><\/pre>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430 Production \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b ClosedXml.dll \u0438 DocumentFormat.OpenXml.dll \u0432 \u0432\u0430\u0448 \u043f\u0430\u043a\u0435\u0442. \u041a\u043d\u043e\u043f\u043a\u0438 Ribbon \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043e\u0434\u043d\u0443 \u0444\u0438\u0447\u0443 \u0443\u0440\u043e\u0432\u043d\u044f Site \u0438\u043b\u0438 Web.<\/p>\n<p>  \u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u2014 <a href=\"https:\/\/spsamples.codeplex.com\/SourceControl\/latest#ExportToExcel\/\">spsamples.codeplex.com\/SourceControl\/latest#ExportToExcel\/<\/a><\/p>\n<p>  \u0413\u043e\u0442\u043e\u0432\u044b\u0439 WSP \u0444\u0430\u0439\u043b \u0442\u0443\u0442 \u2014 <a href=\"https:\/\/spsamples.codeplex.com\/releases\/view\/117220\">spsamples.codeplex.com\/releases\/view\/117220<\/a><\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430, \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 SharePoint. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 ASP.NET.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/208948\/\"> http:\/\/habrahabr.ru\/post\/208948\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 Excel \u0432 SharePoint \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 SharePoint \u043e\u0442\u0434\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f Excel, \u0438 \u0443\u0436\u0435 \u0441\u0430\u043c Excel \u0437\u0430\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Excel \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u041d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\u041d\u0443\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Excel \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. <\/li>\n<li>\u0412 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f InternalName \u043f\u043e\u043b\u0435\u0439. <\/li>\n<li>\u0412 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u201c\u0441\u044b\u0440\u043e\u0439\u201d \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442.<\/li>\n<\/ul>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u0441\u0432\u043e\u044e \u0442\u0430\u043a, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u044f\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-208948","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208948"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208948\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}