Guest User

Untitled

a guest
Jul 17th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. SaveFileDialog^ sfd = gcnew SaveFileDialog();
  2. String ^ HTMLWay;
  3. sfd->Title = "Save HTML";
  4. sfd->OverwritePrompt = true;
  5. sfd->CheckPathExists = true;
  6. sfd->Filter = "Html files (*.html)|*.html|All files (*.*)|*.*";
  7. sfd->ShowHelp = true;
  8. if (sfd->ShowDialog() == Windows::Forms::DialogResult::OK)
  9. {
  10. try
  11. {
  12. StreamWriter ^ NewHTML = gcnew StreamWriter(sfd->FileName);
  13. NewHTML->WriteLine("<html>");
  14. NewHTML->WriteLine("<head>");
  15. NewHTML->WriteLine("<title>My Report</title>");
  16. NewHTML->WriteLine("</head>");
  17. NewHTML->WriteLine("<body>");
  18. NewHTML->WriteLine("My Amount: " + Result_of_Amount->Text + "<br>");
  19. NewHTML->WriteLine("Iterations: " + IterationsRes->Text + "<br>");
  20. NewHTML->WriteLine("Size of amount: " + SizeBox->Text + "<br>");
  21. NewHTML->WriteLine("My Massive[i][j]:<br>");
  22. for (int i = 0; i < numericUpDown2->Value; i++) {
  23. for (int j = 0; j < numericUpDown1->Value; j++) {
  24. if (j != Convert::ToInt32(numericUpDown1->Value) - 1) {
  25. NewHTML->Write(Convert::ToString(Convert::ToInt32(dataGridView1->Rows[i]->Cells[j]->Value)) + " ");
  26. }
  27. else {
  28. NewHTML->Write(Convert::ToString(Convert::ToInt32(dataGridView1->Rows[i]->Cells[j]->Value)) + "<br>");
  29. }
  30. }
  31. }
  32. NewHTML->WriteLine("<br>");
  33. NewHTML->WriteLine("<img src= "Report.bmp""alt="Report">");
  34. NewHTML->WriteLine("</body>");
  35. NewHTML->WriteLine("</html>");
  36. NewHTML->Close();
  37. }
  38. catch (...)
  39. {
  40. MessageBox::Show("You can save it", "ERROR", MessageBoxButtons::OK, MessageBoxIcon::Error);
  41. }
  42. }
  43.  
  44. private: System::Void HTMLOpen_Click(System::Object^ sender, System::EventArgs^ e) {
  45. OpenFileDialog^ open = gcnew OpenFileDialog();
  46. open->Filter = "Html files (*.html)|*.html|All files (*.*)|*.*";
  47. if (open->ShowDialog() == Windows::Forms::DialogResult::OK)
  48. {
  49. webBrowser1->Navigate(open->FileName);
  50. }
  51. }
Add Comment
Please, Sign In to add comment