예제 #1
0
        private void SaveToWordFile()
        {
            ScreenCapture sc = new ScreenCapture();

            // capture entire screen, and save it to a file
            System.Drawing.Image img1 = sc.CaptureScreen();
            // display image in a Picture control named imageDisplay
            pictureBox1.Image = img1;
            // capture this window, and save it;
            //sc.CaptureWindowToFile(this.Handle, Guid.NewGuid()+".gif", ImageFormat.Gif);
            img1.Save("Screenshot" + ".jpg", ImageFormat.Gif);
            counter++;
            string fileName = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\" + "Capture Screen" + "\\";

            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\" + "Capture Screen" + "\\"))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\" + "Capture Screen" + "\\");
            }
            if (!File.Exists(fileName + DateTime.Now.ToString("dd-MM-yyyy") + ".docx"))
            {
                var docCreate = DocX.Create(fileName + DateTime.Now.ToString("dd-MM-yyyy") + ".docx");
                docCreate.Save();
            }
            var     docload = DocX.Load(fileName + DateTime.Now.ToString("dd-MM-yyyy") + ".docx");
            Image   img     = docload.AddImage("Screenshot.jpg");
            Picture p       = img.CreatePicture();

            p.Width  = 690;
            p.Height = 365;
            Xceed.Words.NET.Paragraph par = docload.InsertParagraph(Convert.ToString(counter));
            par.AppendPicture(p);
            docload.Save();
        }
예제 #2
0
        private async void Button_Copy2_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == false)
            {
                return;
            }

            string filename     = saveFileDialog1.FileName;
            string pathDocument = filename + ".docx";
            DocX   document     = DocX.Create(pathDocument);

            document.InsertParagraph("Записи сотрудника: " + this.Tag.ToString()).
            FontSize(24).
            Bold().
            Alignment = Alignment.center;


            Xceed.Words.NET.Paragraph paragraph = document.InsertParagraph();
            paragraph.Alignment = Alignment.right;

            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Салон]", SqlConnection);

            sqlReader = command1.ExecuteReader();

            int for_sum = 0;

            while (sqlReader.Read())
            {
                if (Convert.ToString(sqlReader["Мастер"]) == this.Tag.ToString())
                {
                    document.InsertParagraph("Клиент: " + Convert.ToString(sqlReader["Клиент"]));
                    document.InsertParagraph("Телефон: " + Convert.ToString(sqlReader["Телефон"]));
                    document.InsertParagraph("Мастер: " + Convert.ToString(sqlReader["Мастер"]));
                    document.InsertParagraph("Услуги: " + Convert.ToString(sqlReader["Услуга"]));
                    document.InsertParagraph("Цена: " + Convert.ToString(sqlReader["Цена"]));
                    document.InsertParagraph("Дата: " + Convert.ToString(sqlReader["Дата"]));
                    document.InsertParagraph("");

                    for_sum += Convert.ToInt32(sqlReader["Цена"]);
                }
            }

            document.InsertParagraph("Итог: " + Convert.ToString(for_sum));

            document.Save();
        }
예제 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string filename = "test.docx";
            var    doc      = DocX.Create(filename);
            //doc.InsertParagraph("Hello Word");

            string title          = "ROK - AKCIA";
            string akciaPopis     = "AKCIA - popis";
            string akciaKomentare = "" + "Dear Friends, " + Environment.NewLine + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + Environment.NewLine + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " + "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " + "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum";

            Formatting formatTitle = new Formatting();

            formatTitle.FontFamily = new Font("Algerian");
            formatTitle.Size       = 18;

            //ako daleko za textom s tymto formatovanim moze byt dalsi text
            formatTitle.Position = 40;
            //zistit center

            formatTitle.FontColor      = System.Drawing.Color.Orange;
            formatTitle.UnderlineColor = System.Drawing.Color.Green;
            formatTitle.Italic         = true;


            Xceed.Words.NET.Paragraph pgTitle = doc.InsertParagraph(title, false, formatTitle);
            pgTitle.Alignment = Alignment.center;

            Formatting formatText = new Formatting();

            formatText.FontFamily = new Font("Calibri (Základný text)");
            formatText.Size       = 10;
            formatText.Spacing    = 2;
            var textParagraph = doc.InsertParagraph(akciaKomentare, false, formatText);


            var image   = doc.AddImage(@"C:\Projects\Projekty\Kronika106_prihlasovanie\Kronika106\Kronika106\AllPhotos\2007\Zimná chata\AkciaFotka.jpg");
            var picture = image.CreatePicture();

            textParagraph.AppendPicture(picture);



            doc.Save();
            Process.Start("WINWORD.EXE", filename);
        }
예제 #4
0
        private async void Button_Copy_Click1(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == false)
            {
                return;
            }

            string filename     = saveFileDialog1.FileName;
            string pathDocument = filename + ".docx";
            DocX   document     = DocX.Create(pathDocument);

            document.InsertParagraph("Список клиентов фотосалона").
            FontSize(16).
            Bold().
            Alignment = Alignment.left;


            Xceed.Words.NET.Paragraph paragraph = document.InsertParagraph();
            paragraph.Alignment = Alignment.right;

            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Клиенты]", SqlConnection);

            sqlReader = command1.ExecuteReader();

            while (sqlReader.Read())
            {
                document.InsertParagraph("1. Фамилия - " + Convert.ToString(sqlReader["Фамилия"]));
                document.InsertParagraph("2. Имя - " + Convert.ToString(sqlReader["Имя"]));
                document.InsertParagraph("3. Отчество - " + Convert.ToString(sqlReader["Отчество"]));
                document.InsertParagraph("4. Адрес - " + Convert.ToString(sqlReader["Адрес"]));
                document.InsertParagraph("5. E-mail - " + Convert.ToString(sqlReader["E-mail"]));
                document.InsertParagraph("6. Телефон - " + Convert.ToString(sqlReader["Телефон"]));
                document.InsertParagraph("---------------------------------------------");
            }

            document.Save();
        }
예제 #5
0
        private async void Button_Copy_Click1(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == false)
            {
                return;
            }

            string filename     = saveFileDialog1.FileName;
            string pathDocument = filename + ".docx";
            DocX   document     = DocX.Create(pathDocument);

            document.InsertParagraph("Заказы фотосалона").
            FontSize(16).
            Bold().
            Alignment = Alignment.left;


            Xceed.Words.NET.Paragraph paragraph = document.InsertParagraph();
            paragraph.Alignment = Alignment.right;

            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Заказы]", SqlConnection);

            sqlReader = command1.ExecuteReader();

            while (sqlReader.Read())
            {
                document.InsertParagraph("1. Клиент - " + Convert.ToString(sqlReader["Клиент"]));
                document.InsertParagraph("2. Услуги - " + Convert.ToString(sqlReader["Услуги"]));
                document.InsertParagraph("3. Дата создания - " + Convert.ToString(sqlReader["Дата создания"]));
                document.InsertParagraph("4. Дата выполнения - " + Convert.ToString(sqlReader["Дата выполнения"]));
                document.InsertParagraph("5. Цена - " + Convert.ToString(sqlReader["Цена"]));
                document.InsertParagraph("---------------------------------------------");
            }

            document.Save();
        }
예제 #6
0
        private async void Button_Copy_Click1(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == false)
            {
                return;
            }

            string filename     = saveFileDialog1.FileName;
            string pathDocument = filename + ".docx";
            DocX   document     = DocX.Create(pathDocument);

            document.InsertParagraph("Товары фотосалона").
            FontSize(16).
            Bold().
            Alignment = Alignment.left;


            Xceed.Words.NET.Paragraph paragraph = document.InsertParagraph();
            paragraph.Alignment = Alignment.right;

            SqlConnection = new OleDbConnection(connectString);
            await SqlConnection.OpenAsync();

            OleDbDataReader sqlReader = null;

            OleDbCommand command1 = new OleDbCommand("SELECT * FROM [Товары]", SqlConnection);

            sqlReader = command1.ExecuteReader();

            while (sqlReader.Read())
            {
                document.InsertParagraph("1. Наименование - " + Convert.ToString(sqlReader["Наименование"]));
                document.InsertParagraph("2. Тип товара - " + Convert.ToString(sqlReader["Тип товара"]));
                document.InsertParagraph("3. Количество - " + Convert.ToString(sqlReader["Количество"]));
                document.InsertParagraph("4. Цена - " + Convert.ToString(sqlReader["Цена"]));
                document.InsertParagraph("---------------------------------------------");
            }

            document.Save();
        }