Esempio n. 1
0
        void ThisAddIn_SheetChange(object Sh, Microsoft.Office.Interop.Excel.Range Target)
        {
            //MessageBox.Show("ThisAddIn_SheetChange");
            MyRibbon.InvalidateRibbon();

            PivotHelper.PostSheetChange(Target);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsCallback && !IsPostBack)
     {
         PivotHelper.FillPivot(pivotGrid);
         FillRadioItems();
     }
     pivotGrid.DataSource = PivotHelper.GetDataTable();
 }
Esempio n. 3
0
 public bool getEnabled(Office.IRibbonControl control)
 {
     switch (control.Id)
     {
     case "configure":
         return(PivotHelper.IsPivotCell(Globals.ThisAddIn.Application.Selection));
     }
     return(false);
 }
        private void Form1_Load(object sender, EventArgs e)
        {
            pivotGridControl1.DataSource = PivotHelper.GetFullDataTable();
            pivotGridControl1.BestFit();
            fieldProductName.Options.AllowSort = DefaultBoolean.False;

            pivotGridControl1.BeginUpdate();
            fieldProductName.FilterValues.ValuesIncluded = new object[] { "Alice Mutton", "Aniseed Syrup" };
            pivotGridControl1.EndUpdate();
        }
Esempio n. 5
0
        private void SetAttributes()
        {
            WorkplaceEx.LoadHierarchyTree(ref tvwWorkplace);
            tvwWorkplace.Dock        = DockStyle.Fill;
            tvwWorkplace.CheckBoxes  = true;
            tvwWorkplace.AfterCheck += OnAfterCheck;

            cmdPDF.Enabled = cmdExcel.Enabled = false;

            this.txtFrom.Focus();

            htmlBox1.Html = PivotHelper.QuickStart();
        }
Esempio n. 6
0
        public HttpResponseMessage GetWptFile(string filename, string id, string lang)
        {
            using (var ctx = new RT2020Entities())
            {
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest);

                // 2021.10.14 paulus:WebPivotTable 係用 SheetJs 嚟 parse Excel contents,用 CSV 會安全啲
                //var dsUrl = string.Format(_ExcelUrl, filename, id, lang);
                var dsUrl = string.Format(this.CsvUrl, filename, id, lang);

                var wptText = PivotHelper.GetLocalizedWptFile(filename, lang);

                if (wptText != "")
                {
                    //if (File.Exists(wptFile))
                    //{
                    #region 讀入隻 wpt template 化做 response 送返俾 caller
                    //var text = (File.ReadAllText(wptFile)).Replace("#dsUrl#", dsUrl);   //! 替換 wpt 內的 data source Url
                    var text = wptText.Replace("#dsUrl#", dsUrl);   //! 替換 wpt 內的 data source Url
                    var raw  = Encoding.UTF8.GetBytes(text);

                    if (raw != null)
                    {
                        var contentLength = raw.Length;
                        var mimeJson      = "application/json";

                        var statuscode = HttpStatusCode.OK;         // 200 successful
                        response         = Request.CreateResponse(statuscode);
                        response.Content = new StreamContent(new MemoryStream(raw));
                        response.Content.Headers.ContentType   = new MediaTypeHeaderValue(mimeJson);
                        response.Content.Headers.ContentLength = contentLength;

                        ContentDispositionHeaderValue contentDisposition = null;
                        if (ContentDispositionHeaderValue.TryParse("inline; filename=" + filename + ".wpt", out contentDisposition))
                        {
                            response.Content.Headers.ContentDisposition = contentDisposition;
                        }
                    }
                    else
                    {
                        var       message = String.Format("Unable to find resource. Resource \"{0}\" may not exist.", filename);
                        HttpError err     = new HttpError(message);
                        response = Request.CreateErrorResponse(HttpStatusCode.NotFound, err);
                    }
                    #endregion
                    //}
                }
                return(response);
            }
        }
Esempio n. 7
0
        public void clickAction(Office.IRibbonControl control)
        {
            switch (control.Id)
            {
            case "about":
            {
                Forms.frmAbout frm = new Forms.frmAbout();
                frm.ShowDialog();
                frm.Close();
            }
            break;

            case "configure":
            {
                PivotHelper.ConfigEditable(Globals.ThisAddIn.Application.Selection);
            }
            break;
            }
        }
Esempio n. 8
0
 public static void InvalidateRibbon()
 {
     ThisAddIn._ribbon.Invalidate();
     PivotHelper.SetEditable(Globals.ThisAddIn.Application.Selection);
 }
 private void btnRestoreDSRecords_Click(object sender, EventArgs e)
 {
     pivotGridControl1.DataSource = PivotHelper.GetFullDataTable();
 }
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     pivotGridControl1.DataSource = PivotHelper.GetIncompleteDataTable();
 }