Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
            ls.ApplicationFieldFormat = TXTextControl.ApplicationFieldFormat.MSWord;

            textControl1.Load("template.docx", TXTextControl.StreamType.WordprocessingML, ls);
        }
Exemplo n.º 2
0
        private async void ClickSwitch(object parametro)
        {
            if (parametro != null && !string.IsNullOrWhiteSpace(parametro.ToString()))
            {
                switch (parametro.ToString())
                {
                case "filtro_interconsultas":
                    if (!IsFechaIniBusquedaSolValida)
                    {
                        new Dialogos().ConfirmacionDialogo("Validación", "La fecha de inicio tiene que ser menor a la fecha fin!");
                        return;
                    }
                    await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                    {
                        BuscarSolicitudesInterconsulta(selectedAtencion_TipoBuscarValue == -1 ? (short?)null : selectedAtencion_TipoBuscarValue, anioBuscarInter, folioBuscarInter,
                                                       nombreBuscarInter, apellidoPaternoBuscarInter, apellidoMaternoBuscarInter, null,
                                                       fechaInicialBuscarInter, fechaFinalBuscarInter, true);
                    });

                    break;

                case "seleccionar_interconsulta":
                    if (selectedInterconsultaBusqueda == null)
                    {
                        new Dialogos().ConfirmacionDialogo("Validación", "Debe de seleccionar una solicitud de interconsulta");
                        return;
                    }
                    await CargarReporte();

                    if (documento == null)
                    {
                        new Dialogos().ConfirmacionDialogo("Validación", "No se encontro la plantilla del documento");
                        return;
                    }

                    var tc = new TextControlView();
                    tc.Closed += (s, e) =>
                    {
                        PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO);
                    };
                    tc.editor.Loaded += (s, e) =>
                    {
                        var d = new cWord().FillFieldsDocx(documento.DOCUMENTO, diccionario_reporte);
                        //DOCX
                        tc.editor.EditMode = TXTextControl.EditMode.ReadOnly;
                        TXTextControl.LoadSettings _settings = new TXTextControl.LoadSettings();
                        tc.editor.Load(d, TXTextControl.BinaryStreamType.WordprocessingML, _settings);
                        //aqui se mueve el margen del documento, el txttextcontrol maneja como unidad de medida 1/96 de la pulgada, y piensa que el word le esta mandando 40ums solamente, menos de la pulgada.
                        tc.editor.PageMargins.Left  = 100;
                        tc.editor.PageMargins.Right = 100;
                    };
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO);
                    tc.Owner = PopUpsViewModels.MainWindow;
                    tc.Show();

                    break;
                }
            }
        }
        private void MailMerge_IncludeTextMerging(object sender,
                                                  TXTextControl.DocumentServer.MailMerge.IncludeTextMergingEventArgs e)
        {
            // custom handing of XLSX files
            switch (Path.GetExtension(e.IncludeTextField.Filename))
            {
            case ".xlsx":     // Excel file detected

                if (!File.Exists(e.IncludeTextField.Filename))
                {
                    return;
                }

                // load document into temp. ServerTextControl
                using (TXTextControl.ServerTextControl tx =
                           new TXTextControl.ServerTextControl())
                {
                    tx.Create();

                    // Bookmark name is the sheet name of the Excel document
                    TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings()
                    {
                        DocumentPartName = e.IncludeTextField.Bookmark
                    };

                    try
                    {
                        // load the Excel document
                        tx.Load(
                            e.IncludeTextField.Filename,
                            TXTextControl.StreamType.SpreadsheetML,
                            ls);
                    }
                    catch {
                        return;
                    }

                    byte[] data;

                    // save the document using the TX format
                    tx.Save(out data,
                            TXTextControl.BinaryStreamType.InternalUnicodeFormat);

                    e.IncludeTextDocument = data;     // pass back to the field
                }

                break;
            }
        }
        private async void ClickSwitch(object parametro)
        {
            if (parametro != null && !string.IsNullOrWhiteSpace(parametro.ToString()))
            {
                switch (parametro.ToString())
                {
                case "filtro_deceso":
                    if (!IsFechaIniBusquedaDecesoValida)
                    {
                        new Dialogos().ConfirmacionDialogo("Validación", "La fecha de inicio tiene que ser menor a la fecha fin!");
                        return;
                    }
                    await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                    {
                        BuscarDefuncion(anioBuscarDeceso, folioBuscarDeceso, nombreBuscarDeceso, apellidoPaternoBuscarDeceso, apellidoMaternoBuscarDeceso,
                                        fechaInicialBuscarDeceso, fechaFinalBuscarDeceso, true);
                    });

                    break;

                case "seleccionar_deceso":
                    if (selectedDecesoBusqueda == null)
                    {
                        new Dialogos().ConfirmacionDialogo("Validación", "Debe de seleccionar un registro de deceso");
                        return;
                    }

                    var tc = new TextControlView();
                    tc.Closed += (s, e) =>
                    {
                        PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO);
                    };
                    tc.editor.Loaded += (s, e) =>
                    {
                        //DOCX
                        tc.editor.EditMode = TXTextControl.EditMode.ReadOnly;
                        TXTextControl.LoadSettings _settings = new TXTextControl.LoadSettings();
                        tc.editor.Load(selectedDecesoBusqueda.TARJETA_DECESO, TXTextControl.BinaryStreamType.WordprocessingML, _settings);
                    };
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO);
                    tc.Owner = PopUpsViewModels.MainWindow;
                    tc.Show();

                    break;
                }
            }
        }
Exemplo n.º 5
0
        /*-------------------------------------------------------------------------------------------------------
        ** ImportForms method
        **-----------------------------------------------------------------------------------------------------*/
        public static AcroForm[] ImportForms(byte[] Data)
        {
            // check, if the file exists
            if (Data == null)
            {
                throw new InvalidDataException("Data is not valid.");
            }

            string sAcroFormsXml;

            // create a temporary ServerTextControl to import the PDF form XML
            using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
            {
                tx.Create();
                TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
                ls.PDFImportSettings = TXTextControl.PDFImportSettings.GenerateXML;

                tx.Load(Data, TXTextControl.BinaryStreamType.AdobePDF, ls);

                sAcroFormsXml = tx.Text;
            }

            return(ProcessForm(sAcroFormsXml));
        }
Exemplo n.º 6
0
        /*-------------------------------------------------------------------------------------------------------
        ** ImportForms method
        **-----------------------------------------------------------------------------------------------------*/
        public static AcroForm[] ImportForms(string Filename)
        {
            // check, if the file exists
            if (File.Exists(Filename) == false)
            {
                throw new FileNotFoundException("The specified file could not be found.", Filename);
            }

            string sAcroFormsXml;

            // create a temporary ServerTextControl to import the PDF form XML
            using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
            {
                tx.Create();
                TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
                ls.PDFImportSettings = TXTextControl.PDFImportSettings.GenerateXML;

                tx.Load(Filename, TXTextControl.StreamType.AdobePDF, ls);

                sAcroFormsXml = tx.Text;
            }

            return(ProcessForm(sAcroFormsXml));
        }