Ejemplo n.º 1
0
        private void CreateFile(string FileName, bool EmbedSource, TPdfType PdfType, TTagMode TagMode)
        {
            ExcelFile xls = CreateSourceFile();

            using (FlexCelPdfExport pdf = new FlexCelPdfExport(xls, true))
            {
                pdf.PdfType = PdfType;
                pdf.TagMode = TagMode;
                if (EmbedSource)
                {
                    pdf.AttachFile("Report.xlsx", StandardMimeType.Xlsx, "This is the source file used to create the PDF", DateTime.Now, TPdfAttachmentKind.Source,
                                   delegate(TPdfAttachmentWriter attachWriter)
                    {
                        using (MemoryStream ms = new MemoryStream())
                        {
                            xls.Save(ms, TFileFormats.Xlsx);
                            ms.Position = 0;
                            attachWriter.Write(ms);
                        }
                    });
                }
                pdf.Export(FileName);
            }
        }