{"id":118,"date":"2012-06-22T01:17:50","date_gmt":"2012-06-21T21:17:50","guid":{"rendered":"http:\/\/infobs.athn.ru\/?p=118"},"modified":"2012-06-22T01:17:50","modified_gmt":"2012-06-21T21:17:50","slug":"rabota-s-vordom","status":"publish","type":"post","link":"https:\/\/infobase.athn.ru\/program\/2012\/06\/rabota-s-vordom\/","title":{"rendered":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0432\u043e\u0440\u0434\u043e\u043c"},"content":{"rendered":"<p>\u041e\u0447\u0435\u043d\u044c \u0434\u0440\u0435\u0432\u043d\u0438\u0439 \u043a\u043e\u0434 \u043e\u0442 \u042e.\u0411., \u0435\u0449\u0435 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d \u043c\u0435\u0434\u0442\u0435\u0441\u0442\u0430. \u041f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442.<br \/>\n<!--more--><\/p>\n<pre>private void PrintResBtn_Click(object sender, EventArgs e)\n        {\n            this.Cursor = Cursors.WaitCursor; \/\/\u0441\u0442\u0438\u043b\u044c \u043a\u0443\u0440\u0441\u043e\u0440\u0430 - \u0436\u0434\u0443\u0449\u0438\u0439\n\n             SaveResFileD.FileName = StudentLabel.Text + \" \" + TestDateLabel.Text.Substring(0, 11) + \".doc\";\n                SaveResFileD.Filter = \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word (*.doc)|*.doc\";\n                string FilePath = \"\";\n\n                if (SaveResFileD.ShowDialog() == DialogResult.OK)\n                {\n\n                    this.Cursor = Cursors.WaitCursor; \/\/\u0441\u0442\u0438\u043b\u044c \u043a\u0443\u0440\u0441\u043e\u0440\u0430 - \u0436\u0434\u0443\u0449\u0438\u0439\n                    \n\n                    \/\/\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u0444\u0430\u0439\u043b \u0437\u0430\u044f\u0432\u043a\u0438\n                    FileInfo NewRequestFile = new FileInfo(SaveResFileD.FileName);\n                    NewRequestFile.Create().Close();\n\n\n                    ResultRTB.AppendText(\"\\t\\t\\t\\t\u0420\u0415\u0417\u0423\u041b\u042c\u0422\u0410\u0422\u042b \u0422\u0415\u0421\u0422\u0418\u0420\u041e\u0412\u0410\u041d\u0418\u042f \\n\\n \");\n                    ResultRTB.AppendText(\"\\n\\t\\t\u0421\u0442\u0443\u0434\u0435\u043d\u0442  \" + StudentLabel.Text + \"\\t\\t\\t  \u0413\u0440\u0443\u043f\u043f\u0430 \" + GroupBox.Text + \"\\n\\n\");\n                    ResultRTB.AppendText(\"\\t\\t\u0414\u0430\u0442\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  \" + TestDateLabel.Text.Substring(0, 11) + \"\\n\\n\");\n                    ResultRTB.AppendText(TT_TextTaskBox.Text);\n\n                    ResultRTB.AppendText(\"\\n\\n---------------------------------------------------------\\n\");\n                    for (int i = 0; i &lt; ResultGrid.RowCount; i++)\n                    {\n                        ResultRTB.AppendText(&quot;\\t\u0412\u043e\u043f\u0440\u043e\u0441 \u2116 &quot; + (i + 1).ToString() + &quot;\\t&quot; + ResultGrid[0, i].Value.ToString() + &quot;\\n\\t\u041e\u0442\u0432\u0435\u0442 -\\t&quot; + ResultGrid[1, i].Value.ToString() + &quot;\\n\\t\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\\t&quot; + ResultGrid[2, i].Value.ToString() + &quot;\\n&quot;);\n                        ResultRTB.AppendText(&quot;---------------------------------------------------------\\n&quot;);\n                    }\n                    ResultRTB.SaveFile(SaveResFileD.FileName);\n                    FilePath = SaveResFileD.FileName;\n                    this.Cursor = Cursors.Arrow;\n                }\n                try\n                {\n                    \/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 MicrosoftWord\n                    \/\/OBJECT OF MISSING &quot;NULL VALUE&quot;\n                    Object oMissing = System.Reflection.Missing.Value;\n                    Object oTemplatePath = FilePath;\n\n\n                    \/\/OBJECTS OF FALSE AND TRUE\n                    Object oTrue = true;\n                    Object oFalse = false;\n                    \n                    \/\/CREATING OBJECTS OF WORD AND DOCUMENT\n                    Word.Application oWord = new Word.Application();\n                    oWord.Caption = FilePath;\n                    Word.Document oWordDoc = new Word.Document();\n\n\n                   \n\n                    \/\/MAKING THE APPLICATION VISIBLE\n                    oWord.Visible = true;\n                    \n                    \/\/ADDING A NEW DOCUMENT TO THE APPLICATION\n                    oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);\n                    Word.ApplicationClass WordApp =\n                            new Word.ApplicationClass();\n\n                    \n\n\n                }\n                catch (Exception PrEx)\n                {\n                    \n                }\n                finally\n                {\n                    if (DBConnection.State == ConnectionState.Open)\n                        DBConnection.Close();\n                }\n\n                 \/* \/\/\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u0444\u0430\u0439\u043b \u0437\u0430\u044f\u0432\u043a\u0438\n                FileInfo NewResFile = new FileInfo(NewRequestFilePath);\n                NewRequestFile.Create().Close();\n                \/\/RequestBox.SaveFile(NewRequestFilePath);\n\n                try\n                {\n                    \/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 MicrosoftWord\n                    \/\/OBJECT OF MISSING &quot;NULL VALUE&quot;\n                    Object oMissing = System.Reflection.Missing.Value;\n                    Object oTemplatePath = RequestDir + @&quot;\\&quot; + DateTime.Now.Day.ToString() + &quot;.&quot; + DateTime.Now.Month.ToString() + &quot;.&quot; + DateTime.Now.Year.ToString() + &quot;.doc&quot;;\n\n\n                    \/\/OBJECTS OF FALSE AND TRUE\n                    Object oTrue = true;\n                    Object oFalse = false;\n                    \/\/CREATING OBJECTS OF WORD AND DOCUMENT\n                    Word.Application oWord = new Word.Application();\n                    Word.Document oWordDoc = new Word.Document();\n                    \/\/MAKING THE APPLICATION VISIBLE\n                    oWord.Visible = true;\n\n                    \/\/ADDING A NEW DOCUMENT TO THE APPLICATION\n                    oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);\n                    Word.ApplicationClass WordApp =\n                            new Word.ApplicationClass();\n\n\n            \n\n                }\n                catch (Exception PrEx)\n                {\n                    ErrorBox Message = new ErrorBox(&quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0447\u0430\u0442\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u044f\u0432\u043a\u0438\\n\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 &#039;&quot; + NewRequestFilePath + &quot;&#039; \u0438 \\n\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c\\n&quot; + PrEx.Message, &quot;&quot;);\n                    Message.Visible = true;\n                    \/\/MessageBox.Show(&quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0435\u0447\u0430\u0442\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u044f\u0432\u043a\u0438\\n\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 &#039;&quot; + NewRequestFilePath + &quot;&#039; \u0438 \\n\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c\\n&quot; + PrEx.Message,\n                    \/\/&quot;&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error);\n                }\n                finally\n                {\n                    if (DBConnection.State == ConnectionState.Open)\n                        DBConnection.Close();\n                }*\/\n            \n             \/\/   MessageBox.Show(&quot;\u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043a\u0430\u0437\u0430\u043d\u043e&quot;);               \n            \/*  }\n              catch (Exception RequestEx)\n              {\n                  ErrorBox Message = new ErrorBox(&quot;RequestEx.Message \\n\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \\n \u043f\u0440\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0430\u043f\u0442\u0435\u043a\u0443,\\n\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443 &quot;, &quot;&quot;);\n                  Message.Visible = true;\n                  \/\/MessageBox.Show(RequestEx.Message + &quot;\\n\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 &quot;+\n                  \/\/&quot;\\n\u043f\u0440\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u0432 \u0430\u043f\u0442\u0435\u043a\u0443,\\n\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443 &quot;); \n              }\n              finally { DBConnection.Close(); }*\/\n\n\n\n            this.Cursor = Cursors.Arrow;\n\n        }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0447\u0435\u043d\u044c \u0434\u0440\u0435\u0432\u043d\u0438\u0439 \u043a\u043e\u0434 \u043e\u0442 \u042e.\u0411., \u0435\u0449\u0435 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d \u043c\u0435\u0434\u0442\u0435\u0441\u0442\u0430. \u041f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-csharp"],"_links":{"self":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}