我测试了在不打开Excel时没有问题, 如果使用了OpenExcel 方法之后就不好用了。
- if (this.IsPostBack) return;
-
- FpSpread1.EnableContextMenu = true;
-
- //Create this viewport menu using markup or the ContextMenus property in the property window
- FarPoint.Web.Spread.ContextMenu viewportMenu = FpSpread1.ContextMenus[FarPoint.Web.Spread.ContextMenuType.Viewport];
- FarPoint.Web.Spread.MenuItem customViewportItem = new FarPoint.Web.Spread.MenuItem("Viewport item 1");
- customViewportItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 1"));
- customViewportItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 2"));
- viewportMenu.Items.Add(customViewportItem);
- //This row header menu is created here (no markup or design properties)
- FarPoint.Web.Spread.ContextMenu rowHeaderContextMenu = new FarPoint.Web.Spread.ContextMenu();
- rowHeaderContextMenu.Type = FarPoint.Web.Spread.ContextMenuType.RowHeader;
- FarPoint.Web.Spread.MenuItem rowHeaderItem = new FarPoint.Web.Spread.MenuItem("RowHeader item 1");
- rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 1"));
- rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 2"));
- rowHeaderContextMenu.Items.Add(rowHeaderItem);
- FpSpread1.ContextMenus.Add(rowHeaderContextMenu);
- FpSpread1.OpenExcel(Server.MapPath("~/test.xlsx"));
复制代码 |