private void ToolsGenerateReport(object sender, EventArgs e)
        {
            try
            {
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = _analysis.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                    return;
                // selected solution
                SelCasePalletSolution selSolution = new SelCasePalletSolution(null, _analysis, CurrentSolution);
                ReportData reportData = new ReportData(_analysis, selSolution);

                Reporter.CompanyLogo = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;
                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                    return;

                // open file
                if (formReport.OpenGeneratedFile)
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
            }
            catch (Exception ex)
            { _log.Error(ex.ToString()); }
        }
        private void toolStripButtonReport_Click(object sender, EventArgs e)
        {
            try
            {
                Document doc;
                CasePalletAnalysis analysis;
                CasePalletSolution casePalletSol;
                if (!GenerateProject(out doc, out analysis, out casePalletSol))
                    return;
                SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, casePalletSol);

                // define report
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = doc.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                    return;

                Reporter.CompanyLogo = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;

                ReportData reportData = new ReportData(analysis, selSolution);

                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                    return;

                // open file
                if (formReport.OpenGeneratedFile)
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Example #3
0
 private void DocumentTreeView_SolutionReportHtmlClicked(object sender, AnalysisTreeViewEventArgs eventArg)
 {
     try
     {
         // build output file path
         string outputFilePath = Path.ChangeExtension(Path.GetTempFileName(), "html");
         // getting current culture
         string cultAbbrev = System.Globalization.CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName;
         // build report
         ReportData reportObject = new ReportData(
                 eventArg.Analysis, eventArg.SelSolution
                 , eventArg.CylinderAnalysis, eventArg.SelCylinderPalletSolution
                 , eventArg.HCylinderAnalysis, eventArg.SelHCylinderPalletSolution
                 , eventArg.BoxCaseAnalysis, eventArg.SelBoxCaseSolution
                 , eventArg.BoxCasePalletAnalysis, eventArg.SelBoxCasePalletSolution
                 , eventArg.PackPalletAnalysis, eventArg.SelPackPalletSolution
                 );
         Reporter.CompanyLogo = Properties.Settings.Default.CompanyLogoPath;
         Reporter.ImageSizeSetting = (Reporter.eImageSize)Properties.Settings.Default.ReporterImageSize;
         ReporterHtml reporter = new ReporterHtml(
             reportObject
             , Settings.Default.ReportTemplatePath
             , outputFilePath);
         // logging
         _log.Debug(string.Format("Saved report to {0}", outputFilePath));
         // open resulting report
         DocumentSB parentDocument = eventArg.Document as DocumentSB;
         DockContentReport dockContent = CreateOrActivateHtmlReport(reportObject, outputFilePath);
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }