Ejemplo n.º 1
0
        public ActionResult Export()
        {
            var            model              = Product.GetProducts();
            IBasePrintable gridViewPrintable  = GridViewExtension.CreatePrintableObject(ViewsHelper.CreateGridViewSettings(), model);
            IBasePrintable pivotGridPrintable = PivotGridExtension.CreatePrintableObject(ViewsHelper.CreatePivotGridSettings(), model);

            XtraReport report = new SampleReport(gridViewPrintable, pivotGridPrintable);

            MemoryStream stream = new MemoryStream();

            report.ExportToPdf(stream);

            return(File(stream.ToArray(), "application/pdf"));
        }
Ejemplo n.º 2
0
    MemoryStream InitializeThumbnail(IBasePrintable component)
    {
        PrintableComponentLinkBase pcl = new PrintableComponentLinkBase(new PrintingSystemBase());

        pcl.Component = component;
        pcl.CreateDocument();
        ImageExportOptions imgOptions = new ImageExportOptions();

        imgOptions.ExportMode      = ImageExportMode.SingleFilePageByPage;
        imgOptions.Format          = System.Drawing.Imaging.ImageFormat.Png;
        imgOptions.PageRange       = "1";
        imgOptions.PageBorderWidth = 0;
        MemoryStream stream = new MemoryStream();

        pcl.ExportToImage(stream, imgOptions);
        stream.Position = 0;
        return(stream);
    }
Ejemplo n.º 3
0
        private static Bitmap ExportToImage(IBasePrintable component)
        {
            PrintableComponentLinkBase pLink = new PrintableComponentLinkBase(new PrintingSystemBase());

            pLink.Component = component;
            pLink.CreateDocument(true);

            MemoryStream       mStream = new MemoryStream();
            ImageExportOptions options = new ImageExportOptions();

            options.ExportMode = ImageExportMode.SingleFilePageByPage;
            options.PageRange  = "1";
            pLink.ExportToImage(mStream, options);
            mStream.Position = 0;
            Bitmap bm = new Bitmap(mStream);

            mStream.Close();

            return(bm);
        }
Ejemplo n.º 4
0
    string GenerateThumbnail(FileManagerItem item)
    {
        string virtPath = Path.Combine("~", item.FullName);
        string fullname;

        fullname = GetFileName(virtPath);
        string extention = Path.GetExtension(item.RelativeName);
        Stream contentStream;

        using (contentStream = File.OpenRead(fullname)) {
            IBasePrintable component     = CreatePrintableComponent(extention, contentStream);
            MemoryStream   stream        = InitializeThumbnail(component);
            string         thumbPath     = @"~\Imgs";
            string         fullThumbname = GetFileName(thumbPath);
            fullThumbname = Path.Combine(fullThumbname, item.Name + ".png");
            if (!File.Exists(fullThumbname))
            {
                GenerateThumbnailInternal(stream, fullThumbname, THUMBNAILS_SIZE, THUMBNAILS_SIZE);
            }
            return(Path.Combine("~\\Imgs\\", item.Name + ".png"));
        }
    }
 public SampleReport(IBasePrintable gridViewPrintable, IBasePrintable pivotGridPrintable)
 {
     InitializeComponent();
     pcGridView.PrintableComponent  = gridViewPrintable;
     pcPivotGrid.PrintableComponent = pivotGridPrintable;
 }
Ejemplo n.º 6
0
 ComponentExporter IChartRenderProvider.CreateComponentPrinter(IBasePrintable iPrintable)
 {
     return(new ComponentExporter(iPrintable));
 }