Exemplo n.º 1
0
        private void Print(mshtml.IHTMLDocument2 doc)
        {
            if (doc != null)
            {
                // Aby se stránka vytiskla bez hlavičky a patičky, tak je potřeba to upravit v nastevení IE v registrech
                // Po skončení tisku jsou registry obnoveny do původní podoby
                try
                {
                    const string keyName = @"Software\Microsoft\Internet Explorer\PageSetup";
                    using (var key = Registry.CurrentUser.OpenSubKey(keyName, true))
                    {
                        if (key != null)
                        {
                            var oldFooter = key.GetValue("footer");
                            var oldHeader = key.GetValue("header");
                            key.SetValue("footer", "");
                            key.SetValue("header", "");
                            doc.execCommand("Print", true, null);
                            key.SetValue("footer", oldFooter);
                            key.SetValue("header", oldHeader);
                            return;
                        }
                    }
                }
                catch
                {
                }

                // při chybě úpravy registrů bude mít export nežádoucí hlavičku - alespoň se ale tisk podaří
                doc.execCommand("Print", true, null);
            }
        }
 private void Initialize()
 {
     webBrowser.Navigate("about:blank");
     doc            = (mshtml.IHTMLDocument2)webBrowser.Document;
     doc.designMode = "On";
     doc.execCommand("EditMode", false, null);
 }
Exemplo n.º 3
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            mshtml.IHTMLDocument2 doc = webBrowser1.Document as mshtml.IHTMLDocument2;
            doc.execCommand("Print", true, 0);
            doc.close();

            ViewModel.SetPrintControlsVisibility(false);
        }
Exemplo n.º 4
0
        private void File_Print(object sender, RoutedEventArgs e)
        {
            string printContents;

            printContents = ViewModel.GetPrintContents();

            mshtml.IHTMLDocument2 doc = webBrowser1.Document as mshtml.IHTMLDocument2;
            doc.clear();
            doc.write(printContents);
            doc.execCommand("Print", true, 0);
            doc.close();
        }
Exemplo n.º 5
0
 private void ButtonBold_Click(object sender, System.EventArgs e)
 {
     _htmlDoc.execCommand("Bold", false, null);
     HtmlEditor.Focus();
 }
Exemplo n.º 6
0
 private void redToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (edits)
     {
         doc.execCommand("BackColor", false, "red");
     }
 }
Exemplo n.º 7
0
 // Друк результатів розрахунку для друку (виклик з меню)
 private void MenuPrint_Click(object sender, RoutedEventArgs e)
 {
     mshtml.IHTMLDocument2 doc = this.WebBrowserCalc.Document as mshtml.IHTMLDocument2;
     doc.execCommand("Print", true, null);
 }
Exemplo n.º 8
0
 private void btnPrint_Click(object sender, RoutedEventArgs e)
 {
     mshtml.IHTMLDocument2 doc = browser.Document as mshtml.IHTMLDocument2;
     doc.execCommand("Print", true, null);
 }
Exemplo n.º 9
0
 private void Wb_Navigated(object sender, NavigationEventArgs e)
 {
     System.Threading.Thread.Sleep(100);
     mshtml.IHTMLDocument2 doc = wb.Document as mshtml.IHTMLDocument2;
     doc.execCommand("Print", true, null);
 }
 private void BtnPrint_Click(object sender, RoutedEventArgs e)
 {
     doc.execCommand("Print", true, null);
 }