{"id":177609,"date":"2013-04-23T14:40:06","date_gmt":"2013-04-23T10:40:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177609"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177609","title":{"rendered":"<span class=\"post_title\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 FTP \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 xlsx (Cach\u00e9 Object Script)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0412\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u0442\u0435\u043c\u044b:  <\/p>\n<ol>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 FTP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e %Net.FtpSession<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 xls<\/li>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432<\/li>\n<\/ol>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 FTP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/h4>\n<p>  \u0412\u0435\u0431\u0441\u0435\u0440\u0432\u0438\u0441\u044b? \u041d\u0435, \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438.<br \/>  \u0422\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0434\u043d\u044f \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043e\u043c \u00ab\u0425\u044d\u00bb. IT \u043e\u0442\u0434\u0435\u043b \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043d\u0430\u0441\u0442\u0430\u0438\u0432\u0430\u043b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 FTP \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u0431\u043c\u0435\u043d\u0430 \u044f\u0440\u043e\u0441\u0442\u043d\u043e \u043e\u0442\u0432\u0435\u0440\u0433\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>  \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"html\">s ftp = ##class(%Net.FtpSession).%New() \u2013 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 FTP ftp.Timeout = \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445  \u2013 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 ftp.Connect(\u0445\u043e\u0441\u0442,  \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u043e\u0440\u0442) \u2013 \u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u043a FTP ftp.SetDirectory(\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f) \u2013 \u043f\u0443\u0442\u044c \u043a \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 FTP (\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439) ftp.List(\u043c\u0430\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u0430,  \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e) \u2013 \u0432\u0435\u0440\u043d\u0451\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u0441\u043a\u0435, \u043d\u0430 \u0424\u0422\u041f \u0432 \u043f\u043e\u0442\u043e\u043a ftp.Binary() \u2013 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 ftp.Retrieve(\u0444\u0430\u0439\u043b, .GlobalStream) \u2013 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u043b\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a ftp.Delete(\u0444\u0430\u0439\u043b) \u2013 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 ftp.Append(\u0438\u043c\u044f\u0444\u0430\u0439\u043b\u0430, \u043f\u043e\u0442\u043e\u043a)  - \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ftp.Logout() \u2013 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 FTP \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430 <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440  \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 FTP \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0444\u0430\u0439\u043b\u044b \u043e\u0442\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u043a\u0435).<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">ClassMethod FTPGetFiles(ftp, fileName) As %Status {     s ftp = ##class(%Net.FtpSession).%New()     s ftp.Timeout = 2000      s host = &quot;11.111.11.111&quot;     s port = 2021     s user = &quot;myth\/user&quot;     s pass = &quot;userspass&quot;          if ftp.Connect(host, user, pass, port)     {     \td ftp.SetDirectory(&quot;\/TestDir&quot;)     \t\/\/ \u041c\u0430\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u0430     \ts fileName = &quot;????????t??????vK*.xml&quot;         \/\/ \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u043e \u043c\u0430\u0441\u043a\u0435 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435         d ..ParserDir(ftp, fileName)              \ts fileName = &quot;????????a??????yK*.xml&quot;         d ..ParserDir(ftp, fileName)     }          q ftp.Logout() }  \/\/\/ \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043c\u0430\u0441\u043a\u0435 ClassMethod ParserDir(ftp, fileName) As %Status {     s file = &quot;&quot;     s x = 1     s file(x) = &quot;&quot;          \/\/ \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a     d ftp.List(fileName, .stream)     q:'$IsObject(stream)         while 'stream.AtEnd      {      \t\/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \t\ts file = stream.ReadLine(1, .sc, .eol)  \t\tif ( file = $C(10) ) \t\t{ \t\t\t\/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0444\u0430\u0439\u043b\u0430 \t\t\ts x = x + 1 \t\t    s file(x) = &quot;&quot; \t\t}  \t\telse  \t\t{ \t\t\t\/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0444\u0430\u0439\u043b\u0430 \t\t    s file(x) = file(x) _ file \t\t} \t\tif $$$ISERR(sc)  \t\t{ \t\t    w &quot;ERROR&quot;  \t\t    q \t\t}     }          \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c     d ftp.Binary()     \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430     s key = $ORDER(file(&quot;&quot;),1)          while ( key '= &quot;&quot; )     { \t    \/\/ \u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430         s fName = $E(file(key), 40, *)         if ( $L(fName) &gt; 0 )  \t\t{             #dim GlobalStream As %GlobalBinaryStream;             \t \t\t\t\/\/ \u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c fName. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437-\u0437\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432\u0438\u043d\u0434\u043e\u0432\u043e\u0433\u043e FTP \u0438 \u043f\u0438\u0441\u0435\u043c \u0432 CP1251 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438             d ftp.Retrieve($zcvt($zcvt(fName,&quot;I&quot;,&quot;CP1251&quot;),&quot;O&quot;,&quot;CP1251&quot;),.GlobalStream)             #dim status As %String;                          \/\/ \u041f\u043e\u0438\u0441\u043a \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u044b \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430             if ( $F(fName,&quot;s&quot;) &gt; 0 )              {\t                             s status = ..Parser(GlobalStream, &quot;Product&quot;, &quot;Shipment&quot;, parser)             }              elseif ( $F(fName,&quot;d&quot;) &gt; 0 )              {                 s status = ..Parser(GlobalStream, &quot;Product&quot;, &quot;Disposal&quot; ,parser)             }             if ( status )             {                 d ftp.Delete(fName)             }         }                  s key = $order(file(key),1)     }  \tq ftp.Logout() } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 FTP \u0441\u0435\u0440\u0432\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">\/\/\/ \u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 FTP \u0441\u0435\u0440\u0432\u0435\u0440 ClassMethod RunExport() As %Status { \ts ftp = ##class(%Net.FtpSession).%New() \ts ftp.Timeout = 2000 \ts host = &quot;11.111.11.111&quot; \ts port = 2021 \ts user = &quot;myth\/user&quot;     s pass = &quot;userspass&quot;  \tif ftp.Connect(host, user, pass, port)  \t{ \t\td ftp.Binary() \t\t \t\t\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e \u043c\u0430\u0441\u043a\u0435 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \t\ts st = ##class(%SQL.Statement).%New() \t\td st.%PrepareClassQuery(&quot;%File&quot;,&quot;FileSet&quot;) \t\ts rs = st.%Execute(&quot;\/usr\/cachesys201221\/csp\/sm\/export_xml&quot;,&quot;*.xml&quot;,&quot;Size,Name&quot;)  \t\twhile rs.%Next()  \t\t{ \t\t\t\/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \t\t\td ftp.Delete(rs.%GetData(6)) \t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 \u043f\u043e\u0442\u043e\u043a \t\t\ts stream = ##class(%FileBinaryStream).%New() \t\t\t\/\/ 1 - \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \t\t\ts stream.Filename = rs.%GetData(1)  \t\t\t\/\/ \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0423\u0421\u041f\u0415\u0428\u041d\u041e \u0434\u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 - \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e &quot;done&quot; \t\t\tif ( ftp.Append(rs.%GetData(6),stream) = $$$OK )  \t\t\t{ \t\t\t\td ##class(%File).Rename(rs.%GetData(1), ##class(%File).GetDirectory(rs.%GetData(1)) _ &quot;done\/&quot; _ rs.%GetData(6)) \t\t\t}  \t\t\tk stream \t\t}  \t}  \td ftp.Logout() \tk ftp  \tq $$$OK }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 xlsx.<\/h4>\n<p>  \u041d\u0438\u0447\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u0440\u0430\u0434\u0443\u0435\u0442, \u043a\u0430\u043a \u0433\u043e\u0440\u0435 \u0443 \u0441\u043e\u0441\u0435\u0434\u0430.<br \/>  \u0425\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043c\u043d\u044e, \u043a\u0430\u043a \u0443\u0442\u0440\u043e\u043c, \u043f\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0443 \u0432 \u043e\u0444\u0438\u0441, \u043c\u043d\u0435 \u0443\u043b\u044b\u0431\u0430\u043b\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u0438 \u043d\u0435 \u0431\u0435\u0437 \u0434\u043e\u043b\u0438 \u0437\u043b\u043e\u0440\u0430\u0434\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u043f\u043e\u0440\u0442\u043e\u0432\u0430\u043b \u043e \u0432\u044b\u0445\u043e\u0434\u0435 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Mozilla Firefox. \u0410 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 excel \u0432 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u0445 \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043d\u0430 visual-C \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443. \u041f\u043e\u0441\u043b\u0435 \u0441\u043c\u0435\u043d\u044b \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 FireFox, \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u043b\u043e \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u043c\u0435\u043d\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e SDK \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c DLL-\u043a\u0443 (\u0438 \u043f\u043b\u0430\u0433\u0438\u043d \u0432 \u0446\u0435\u043b\u043e\u043c), \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u2013 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0448\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f DLL-\u043a\u0438 \u0438 JS \u043f\u0430\u0440\u0441\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b). \u041f\u0440\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0434\u043d\u044f \u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u0443\u043b\u0438\u0446\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u0433\u0440\u0443\u0437\u043e\u0432\u0438\u043a \u0441 \u043f\u0435\u0447\u0435\u043d\u044c\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 Excel, \u043a\u043e\u0438\u043c \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0412\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>\u0411\u0435\u0440\u0451\u043c (\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c) html \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/li>\n<li>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b, \u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0430 xls<\/li>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0436\u043c\u0430\u043a\u043d\u0443\u0442\u044c \u00ab\u0434\u0430\u00bb \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0435 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u2026 \u0432\u0443\u0430\u043b\u044f! \u042d\u043a\u0441\u0435\u043b\u044c \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b \u043d\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u044f\u0447\u0435\u0439\u043a\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c css \u0441\u0442\u0438\u043b\u0438 \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">#server(TestProject.MakeExcelFile($(&quot;#table_to_excel&quot;).html(), &quot;PriceList&quot;))#  ClassMethod MakeExcelFile(Data As %String, FileName As %String) As %Status { \ts FileName = &quot;\/tkf\/reports\/&quot; _ FileName _ &quot;_Excel.xls&quot; \t        \ts stream = ##class(%Library.FileCharacterStream).%New()     \ts FP = $$GetFilename^%apiCSP(FileName)       \tif ( $L(Data) = 22 )   \t{      \t\td stream.CopyFrom(Data)    \t }     \telse     \t{      \t\td stream.Write(Data)    \t }       \td stream.SetAttribute(&quot;Content-Length&quot;,stream.Size)     \td stream.SetAttribute(&quot;ContentType&quot;,&quot;application\/excel&quot;)     \td stream.SetAttribute(&quot;Charset&quot;,&quot;UTF8&quot;)     \td stream.SetAttribute(&quot;ContentDisposition&quot;,&quot;attachment; filename=&quot; _ $p(FileName,&quot;\/&quot;,4))     \td stream.LinkToFile(FP)     \td stream.SaveStream()         \ts oid = stream.%Oid()       &js&lt;window.location=&quot;#url(%25CSP.StreamServer.cls?STREAMOID=#(..Encrypt(oid))#)#&quot;;&gt;   q $$$OK  }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u042f\u0447\u0435\u0439\u043a\u0435, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430 \u2014 <code>&lt;td style=\u201dfont-size:18px\u201d&gt;\u0410\u043d\u043d\u0430 \u0410\u043d\u0442\u043e\u043d\u043e\u0432\u0430&lt;\/td&gt;<\/code>, \u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f \u0444\u043e\u0440\u043c\u0430\u0442\u0430:<\/p>\n<pre><code class=\"html\">&lt;style&gt;.toText{ mso-number-format:\\&quot;\\@\\&quot;; } &lt;\/style&gt; &lt;td class=\u201dtoText\u201d&gt;\u0410\u043d\u043d\u0430 \u0410\u043d\u0442\u043e\u043d\u043e\u0432\u0430&lt;\/td&gt; <\/code><\/pre>\n<h4>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b<\/h4>\n<p>  <\/p>\n<h6>\u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/h6>\n<p>   \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043d\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442, \u0447\u0442\u043e \u0432 COS \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u0438\u0445:<\/p>\n<p>  Set = s<br \/>  Do = d<br \/>  Write = w<br \/>  Kill = k<br \/>  Quit = q<br \/>  \u2026<\/p>\n<p>  \u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u044b \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f37\/424\/c36\/f37424c36881ba1c38ffad72441f7d1e.png\"\/>  <\/p>\n<h6>\u0422\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f<\/h6>\n<p>  COS \u2014 \u044f\u0437\u044b\u043a \u0431\u0435\u0437 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f #dim<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/9cb\/1ba\/8ad\/9cb1ba8ad433ed5acea298a647ac54b2.png\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/357\/b91\/168\/357b91168d9cac3f9b00571e3e507c2f.png\"\/><\/p>\n<h6>$CLASSNAME \u0432 SQL<\/h6>\n<p>  \u0420\u0435\u0434\u043a\u0438\u0439, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u2013 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 (\u0410\u043d\u0430\u043b\u043e\u0433 $CLASSNAME \u0432 SQL), \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u043f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0441\u0443\u0449\u0435 \u0432\u0441\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u2014 x__classname.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0415\u0441\u0442\u044c 2 \u043a\u043b\u0430\u0441\u0441\u0430 A \u0438 B, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043a\u0430 Letters Extends %Persistent. \u0412\u043a\u043b\u044e\u0447\u0438\u043c \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e\u043b\u0435 x__classname.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/353\/115\/2e0\/3531152e0254b6e29a5042ee510f0312.png\"\/><\/p>\n<p>  \u0412\u0435\u0440\u0441\u0438\u044f Cache \u2014 Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2012.2.1 (Build 705U) Wed Oct 24 2012 14:32:01 EDT.    \t \t\t   \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\/177609\/\"> http:\/\/habrahabr.ru\/post\/177609\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0412\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u0442\u0435\u043c\u044b:  <\/p>\n<ol>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 FTP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e %Net.FtpSession<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 xls<\/li>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432<\/li>\n<\/ol>\n<p>  <\/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-177609","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177609","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=177609"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177609\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}