Esempio n. 1
0
        void Export(bool saveAs)
        {
            //foreach(PivotGridField field in gvDashboard.Fields) {
            //    if(field.ValueFormat != null && !string.IsNullOrEmpty(field.ValueFormat.FormatString))
            //        field.UseNativeFormat = checkCustomFormattedValuesAsText.Checked ? DefaultBoolean.False : DefaultBoolean.True;
            //}
            //ASPxPivotGridExporter1.OptionsPrint.PrintHeadersOnEveryPage = checkPrintHeadersOnEveryPage.Checked;
            //ASPxPivotGridExporter1.OptionsPrint.MergeColumnFieldValues = checkMergeColumnFieldValues.Checked;
            //ASPxPivotGridExporter1.OptionsPrint.MergeRowFieldValues = checkMergeRowFieldValues.Checked;

            //ASPxPivotGridExporter1.OptionsPrint.PrintFilterHeaders = checkPrintFilterFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            //ASPxPivotGridExporter1.OptionsPrint.PrintColumnHeaders = checkPrintColumnFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            //ASPxPivotGridExporter1.OptionsPrint.PrintRowHeaders = checkPrintRowFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            //ASPxPivotGridExporter1.OptionsPrint.PrintDataHeaders = checkPrintDataFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;

            string fileName = "PivotGrid";

            switch (listExportFormat.SelectedIndex)
            {
            case 0:
                ASPxPivotGridExporter1.ExportPdfToResponse(fileName, saveAs);
                break;

            case 1:
                ASPxPivotGridExporter1.ExportXlsToResponse(fileName, saveAs);
                break;

            case 2:
                ASPxPivotGridExporter1.ExportMhtToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true, saveAs);
                break;

            case 3:
                ASPxPivotGridExporter1.ExportRtfToResponse(fileName, saveAs);
                break;

            case 4:
                ASPxPivotGridExporter1.ExportTextToResponse(fileName, saveAs);
                break;

            case 5:
                ASPxPivotGridExporter1.ExportHtmlToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true, saveAs);
                break;
            }
        }
Esempio n. 2
0
        protected void buttonSaveAs_Click(object sender, EventArgs e)
        {
            foreach (DevExpress.Web.ASPxPivotGrid.PivotGridField field in ASPxPivotGrid1.Fields)
            {
                if (field.ValueFormat != null && !string.IsNullOrEmpty(field.ValueFormat.FormatString))
                {
                    field.UseNativeFormat = checkCustomFormattedValuesAsText.Checked ? DefaultBoolean.False : DefaultBoolean.True;
                }
            }

            ASPxPivotGridExporter1.OptionsPrint.PrintColumnAreaOnEveryPage = checkPrintColumnAreaOnEveryPage.Checked;
            ASPxPivotGridExporter1.OptionsPrint.PrintRowAreaOnEveryPage    = checkPrintRowAreaOnEveryPage.Checked;
            ASPxPivotGridExporter1.OptionsPrint.MergeColumnFieldValues     = checkMergeColumnFieldValues.Checked;
            ASPxPivotGridExporter1.OptionsPrint.MergeRowFieldValues        = checkMergeRowFieldValues.Checked;

            ASPxPivotGridExporter1.OptionsPrint.PrintFilterHeaders = checkPrintFilterFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            ASPxPivotGridExporter1.OptionsPrint.PrintColumnHeaders = checkPrintColumnFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            ASPxPivotGridExporter1.OptionsPrint.PrintRowHeaders    = checkPrintRowFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;
            ASPxPivotGridExporter1.OptionsPrint.PrintDataHeaders   = checkPrintDataFieldHeaders.Checked ? DefaultBoolean.True : DefaultBoolean.False;

            const string        fileName = "PivotGrid";
            XlsxExportOptionsEx options;

            switch (listExportFormat.SelectedIndex)
            {
            case 0:
                ASPxPivotGridExporter1.ExportPdfToResponse(fileName);
                break;

            case 1:
                options = new XlsxExportOptionsEx()
                {
                    ExportType = ExportType.WYSIWYG
                };
                ASPxPivotGridExporter1.ExportXlsxToResponse(fileName, options);
                break;

            case 2:
                ASPxPivotGridExporter1.ExportMhtToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true);
                break;

            case 3:
                ASPxPivotGridExporter1.ExportRtfToResponse(fileName);
                break;

            case 4:
                ASPxPivotGridExporter1.ExportTextToResponse(fileName);
                break;

            case 5:
                ASPxPivotGridExporter1.ExportHtmlToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true);
                break;

            case 6:
                options = new XlsxExportOptionsEx()
                {
                    ExportType                  = ExportType.DataAware,
                    AllowGrouping               = allowGroupingCheckBox.Checked ? DefaultBoolean.True : DefaultBoolean.False,
                    TextExportMode              = exportCellValuesAsText.Checked ? TextExportMode.Text : TextExportMode.Value,
                    AllowFixedColumns           = allowFixedColumns.Checked ? DefaultBoolean.True : DefaultBoolean.False,
                    AllowFixedColumnHeaderPanel = allowFixedColumns.Checked ? DefaultBoolean.True : DefaultBoolean.False,
                    RawDataMode                 = exportRawData.Checked
                };
                ASPxPivotGridExporter1.ExportXlsxToResponse(fileName, options);
                break;
            }
        }