예제 #1
0
 private void Grafico_DoubleClick(object sender, EventArgs e)
 {
     if (Guardar.ShowDialog() == DialogResult.OK)
     {
         Grafico.SaveImage(Guardar.FileName, ChartImageFormat.Png);
     }
 }
예제 #2
0
 private void btnDescargar_Click(object sender, EventArgs e)
 {
     if (ValidarForm())
     {
         Guardar.FileName = Guardar.FileName.ToString().Replace(".SVG", ".PNG").Replace(".svg", ".png");
         Image Imagen = pickImagen.Image;
         Guardar.ShowDialog();
         Imagen.Save(Guardar.FileName);
     }
 }
예제 #3
0
파일: Main.cs 프로젝트: Jeff94sl/EdmodoCSV
        public void Exportar()
        {
            try
            {
                DataTable Tb = new DataTable();
                foreach (DataGridViewColumn Col in DGV.Columns)
                {
                    Tb.Columns.Add(Col.HeaderText, Col.ValueType);
                }

                foreach (DataGridViewRow row in DGV.Rows)
                {
                    Tb.Rows.Add();
                    foreach (DataGridViewCell Cells in row.Cells)
                    {
                        Tb.Rows[Tb.Rows.Count - 1][Cells.ColumnIndex] = Cells.Value.ToString();
                    }
                }
                using (XLWorkbook wb = new XLWorkbook())
                {
                    wb.Worksheets.Add(Tb, "Reporte");

                    wb.Worksheet(1).Cells("A1:C1").Style.Fill.BackgroundColor = XLColor.DarkGreen;
                    for (int i = 1; i <= Tb.Rows.Count; i++)
                    {
                        string cellRange = string.Format("A{0}:C{0}", i + 1);
                        if (i % 2 != 0)
                        {
                            wb.Worksheet(1).Cells(cellRange).Style.Fill.BackgroundColor = XLColor.GreenYellow;
                        }
                        else
                        {
                            wb.Worksheet(1).Cells(cellRange).Style.Fill.BackgroundColor = XLColor.Yellow;
                        }
                    }
                    wb.Worksheet(1).Columns().AdjustToContents();
                    string file = Abrir.SafeFileName.Substring(0, Abrir.SafeFileName.Length - 4);
                    Guardar.FileName = file;
                    if (Guardar.ShowDialog() == DialogResult.OK)
                    {
                        wb.SaveAs(Guardar.FileName);
                    }
                }
                SystemSounds.Exclamation.Play();
                MessageBox.Show("Exportado Completo!!!");
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
예제 #4
0
        //Guardar Como
        private void GuardarComo()
        {
            //Guarda el actual archivo en edición en un formato preferido por el usuario.
            Guardar.FileName         = TCPaginas.SelectedTab.Name;
            Guardar.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            Guardar.Filter           = "Archivos de Texto|*.txt|Archivos VB|*.vb|Archivos C#|*.cs|Todos los archivos|*.*";
            Guardar.Title            = "Guardar Como";

            if (Guardar.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (Guardar.FileName.Length > 0)
                {
                    DocumentoActual.SaveFile(Guardar.FileName, RichTextBoxStreamType.PlainText);
                }
            }
        }
예제 #5
0
        //Control de las operaciones de abrir, guardar y guardar como del archivo de código fuente
        //Guardar archivo

        private void GuardarArchivo()
        {
            //Guarda el contenido del textbox actual en un archivo de tipo RTF definido
            //"Guardar" es el nombre del savefiledialog
            //TCPaginas es el nombre el controlTab

            Guardar.FileName         = TCPaginas.SelectedTab.Name;
            Guardar.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            Guardar.Filter           = "RTF|*.rtf";
            Guardar.Title            = "Guardar";

            if (Guardar.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (Guardar.FileName.Length > 0)
                {
                    DocumentoActual.SaveFile(Guardar.FileName, RichTextBoxStreamType.RichText);
                }
            }
        }