private void Form1_Load(object sender, EventArgs e)
        {
            report = new XtraReport1();
            documentViewer1.PrintingSystem = report.PrintingSystem;
            // Get the printing system of the document viewer control.
            PrintingSystemBase ps = documentViewer1.PrintingSystem;

            // Hide the Watermark toolbar button, and also the Watermark menu item.
            if (ps.GetCommandVisibility(PrintingSystemCommand.Watermark) != CommandVisibility.None)
            {
                ps.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None);
            }

            // Show the Document Map toolbar button and menu item.
            ps.SetCommandVisibility(PrintingSystemCommand.DocumentMap, CommandVisibility.All);

            // Make the "Export to Csv" and "Export to Txt" commands visible.
            ps.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt }, CommandVisibility.All);

            // Create the document.
            report.CreateDocument();
        }
Esempio n. 2
0
        private void SetExportOption_GetUserAccess(PrintingSystemBase printingSystem, string User)
        {
            printingSystem.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportXls, PrintingSystemCommand.ExportXlsx }, CommandVisibility.None);
            printingSystem.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportPdf }, CommandVisibility.None);
            printingSystem.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None);
            printingSystem.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None);
            printingSystem.SetCommandVisibility(PrintingSystemCommand.Customize, CommandVisibility.None);
            printingSystem.SetCommandVisibility(PrintingSystemCommand.EditPageHF, CommandVisibility.None);
            printingSystem.SetCommandVisibility(PrintingSystemCommand.ExportGraphic, CommandVisibility.None);
            printingSystem.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportCsv,
                                                                              PrintingSystemCommand.ExportTxt,
                                                                              PrintingSystemCommand.ExportHtm,
                                                                              PrintingSystemCommand.ExportMht,
                                                                              PrintingSystemCommand.ExportRtf,
                                                                              PrintingSystemCommand.ExportXps,
                                                                              PrintingSystemCommand.File,


                                                                              PrintingSystemCommand.Save,
                                                                              PrintingSystemCommand.SendCsv,
                                                                              PrintingSystemCommand.SendFile,
                                                                              PrintingSystemCommand.SendGraphic },
                                                CommandVisibility.None);
        }
Esempio n. 3
0
        /// <summary>
        /// 处理报表打印
        /// </summary>
        /// <param name="tableNameStr">数据表名</param>
        /// <param name="bindingDataSet">绑定的DataSet</param>
        /// <param name="paraList">参数列表</param>
        /// <param name="handleType">处理类型:1 预览 2 打印 3 设计</param>
        public void XtraReport_Handle(string tableNameStr, DataSet bindingDataSet, List <Parameter> paraList, int handleType)
        {
            FrmDocumentTempletDAO docDAO          = new FrmDocumentTempletDAO();
            DataTable             docTempletTable = docDAO.QueryDocTemplet(tableNameStr);

            if (docTempletTable.Rows.Count == 0)
            {
                //MessageHandler.ShowMessageBox("未查询到当前单据模板的信息记录,操作错误。");
                MessageHandler.ShowMessageBox(f.tsmiWcxddq.Text);

                return;
            }

            string path      = DataTypeConvert.GetString(docTempletTable.Rows[0]["DocPath"]) + DataTypeConvert.GetString(docTempletTable.Rows[0]["DocFileName"]);
            string docVerStr = DataTypeConvert.GetString(docTempletTable.Rows[0]["DocVersion"]);

            string      iniPath     = System.Windows.Forms.Application.StartupPath + "\\Report\\DocTemplet.ini";
            string      sectionStr  = "DocTemplet";
            FileHandler fileHandler = new FileHandler();

            if (File.Exists(path))
            {
                if (File.Exists(iniPath))
                {
                    string localVerStr = fileHandler.IniReadValue(iniPath, sectionStr, tableNameStr);
                    if (localVerStr != docVerStr && handleType != 3)
                    {
                        Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                        fileHandler.ByteArrayToFile(fileByte, path);
                        fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
                    }
                }
                else
                {
                    Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                    fileHandler.ByteArrayToFile(fileByte, path);
                    fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
                }
            }
            else
            {
                Byte[] fileByte = docDAO.QueryDocTemplet_FileByte(tableNameStr);
                fileHandler.ByteArrayToFile(fileByte, path);
                fileHandler.IniWriteValue(iniPath, sectionStr, tableNameStr, docVerStr);
            }
            XtraReport report = new XtraReport();

            report.LoadLayout(path);

            report.DataSource = bindingDataSet;
            if (paraList != null)
            {
                foreach (Parameter para in paraList)
                {
                    try
                    {
                        report.Parameters[para.Name].Value = para.Value;
                    }
                    catch
                    {
                        report.Parameters.Add(para);
                    }
                }
            }

            report.RequestParameters = false;
            report.CreateDocument();
            ReportPrintTool    rptPrintTool = new ReportPrintTool(report);
            PrintingSystemBase prtSysBase   = rptPrintTool.PrintingSystem;

            prtSysBase.SetCommandVisibility(new PrintingSystemCommand[] {
                //PrintingSystemCommand.Background,
                //PrintingSystemCommand.ClosePreview,
                //PrintingSystemCommand.Customize,
                //PrintingSystemCommand.DocumentMap,
                //PrintingSystemCommand.EditPageHF,
                //PrintingSystemCommand.ExportCsv,
                //PrintingSystemCommand.ExportFile,
                //PrintingSystemCommand.ExportGraphic,
                //PrintingSystemCommand.ExportHtm,
                //PrintingSystemCommand.ExportMht,
                //PrintingSystemCommand.ExportPdf,
                //PrintingSystemCommand.ExportRtf,
                //PrintingSystemCommand.ExportTxt,
                //PrintingSystemCommand.ExportXls,
                //PrintingSystemCommand.ExportXlsx,
                //PrintingSystemCommand.ExportXps,
                //PrintingSystemCommand.File,
                //PrintingSystemCommand.FillBackground ,
                //PrintingSystemCommand.Find,
                //PrintingSystemCommand.HandTool,
                //PrintingSystemCommand.Magnifier,
                //PrintingSystemCommand.MultiplePages,
                //PrintingSystemCommand.Open,
                //PrintingSystemCommand.PageLayout,
                //PrintingSystemCommand.PageLayoutContinuous,
                //PrintingSystemCommand.PageMargins,
                //PrintingSystemCommand.PageOrientation,
                //PrintingSystemCommand.PageSetup,
                //PrintingSystemCommand.PaperSize,
                PrintingSystemCommand.Parameters,
                //PrintingSystemCommand.Pointer,
                //PrintingSystemCommand.Print,
                //PrintingSystemCommand.PrintDirect ,
                //PrintingSystemCommand.Save,
                //PrintingSystemCommand.SendCsv,
                //PrintingSystemCommand.SendFile,
                //PrintingSystemCommand.SendGraphic,
                //PrintingSystemCommand.SendMht,
                //PrintingSystemCommand.SendPdf,
                //PrintingSystemCommand.SendRtf,
                //PrintingSystemCommand.SendTxt,
                //PrintingSystemCommand.SendXls,
                //PrintingSystemCommand.SendXlsx,
                //PrintingSystemCommand.SendXps,
                PrintingSystemCommand.SubmitParameters,
                //PrintingSystemCommand.View,
                //PrintingSystemCommand.Watermark
            }, DevExpress.XtraPrinting.CommandVisibility.None);

            switch (handleType)
            {
            case 1:
                XtraReport_Preview(report);
                break;

            case 2:
                XtraReport_Print(report);
                break;

            case 3:
                XtraReport_Designer(report, path);
                break;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 프린트 미리보기 화면 세팅
        /// </summary>
        /// <param name="pb"></param>
        private void PrintInit(PrintingSystemBase pb)
        {
            try
            {
                pb.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Thumbnails, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Parameters, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Background, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.FillBackground, CommandVisibility.None);

                pb.SetCommandVisibility(PrintingSystemCommand.ExportCsv, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.ExportGraphic, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.ExportMht, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.ExportRtf, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.ExportXps, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.ExportTxt, CommandVisibility.None);

                pb.SetCommandVisibility(PrintingSystemCommand.SendFile, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.MultiplePages, CommandVisibility.None);

                pb.SetCommandVisibility(PrintingSystemCommand.Customize, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.EditPageHF, CommandVisibility.None);
                pb.SetCommandVisibility(PrintingSystemCommand.Find, CommandVisibility.None);
            }
            catch { }
        }