public override SpreadsheetCommand CreateCommand(SpreadsheetCommandId id) { //if (id == SpreadsheetCommandId.MailMergePreview) //{ // return new MailMergePreviewCommandEx(Control); //} if (id == SpreadsheetCommandId.MailMergeAddDataSource) { return(new MailMergeAddDataSourceCommandEx(Control)); } if (id == SpreadsheetCommandId.FileSave) { if (lastCommand == id) { return(null); } lastCommand = id; return(new SaveCommand(Control)); } lastCommand = id; SpreadsheetCommand command = base.CreateCommand(id); return(command); }
private void btnPrintPreview_Click(object sender, System.Windows.RoutedEventArgs e) { ISpreadsheetCommandFactoryService service = (ISpreadsheetCommandFactoryService)spreadsheetControl1.GetService(typeof(ISpreadsheetCommandFactoryService)); SpreadsheetCommand command = service.CreateCommand(SpreadsheetCommandId.FilePrintPreview); command.ForceExecute(command.CreateDefaultCommandUIState()); }
public OperationState Export() { try { SpreadsheetCommand FileSaveAsCommand = spreadsheetControl.CreateCommand(SpreadsheetCommandId.FileSaveAs); FileSaveAsCommand.Execute(); //this.biFileSaveAs.PerformClick(); } catch (Exception) { return(OperationState.STOP); } return(OperationState.STOP); }
/// <summary> /// Ouvre le dialogue permettant de choisir le document à importer. /// </summary> /// <returns>cre /// OperationState.CONTINUE si l'opération a réussi /// OperationState.STOP sinon /// </returns> public OperationState Import() { SpreadsheetCommand ImportCommand = spreadsheetControl.CreateCommand(SpreadsheetCommandId.FileOpen); ImportCommand.Execute(); //this.biFileOpen.PerformClick(); this.DocumentUrl = this.spreadsheetControl.Options.Save.CurrentFileName; //this.DocumentName = this.Office.GetDocumentName(); if (Changed != null) { Changed(); } return(OperationState.CONTINUE); }
private void SpreadSheet_PopupMenuShowing(object sender, DevExpress.Xpf.Spreadsheet.Menu.PopupMenuShowingEventArgs e) { if (e.MenuType == SpreadsheetMenuType.Cell) { ISpreadsheetCommandFactoryService service = (ISpreadsheetCommandFactoryService)spreadsheetControl.GetService(typeof(ISpreadsheetCommandFactoryService)); SpreadsheetCommand cmd = service.CreateCommand(SpreadsheetCommandId.InsertPicture); if (customlistMenuItems != null) { foreach (string s in customlistMenuItems) { SpreadsheetMenuItem menuItem = new SpreadsheetMenuItem(); menuItem.Tag = s; menuItem.Content = s; menuItem.ItemClick += menuItem_ItemClick; e.Menu.Items.Insert(0, menuItem); } } } }
private void spreadsheetControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { if (e.MenuType == SpreadsheetMenuType.Cell) { // Remove the "Clear Contents" menu item. e.Menu.RemoveMenuItem(SpreadsheetCommandId.FormatClearContentsContextMenuItem); // Disable the "Hyperlink" menu item. e.Menu.DisableMenuItem(SpreadsheetCommandId.InsertHyperlinkContextMenuItem); // Create a menu item for the Spreadsheet command, which inserts a picture into a worksheet. ISpreadsheetCommandFactoryService service = (ISpreadsheetCommandFactoryService)spreadsheetControl1.GetService(typeof(ISpreadsheetCommandFactoryService)); SpreadsheetCommand cmd = service.CreateCommand(SpreadsheetCommandId.InsertPicture); SpreadsheetMenuItemCommandWinAdapter menuItemCommandAdapter = new SpreadsheetMenuItemCommandWinAdapter(cmd); SpreadsheetMenuItem menuItem = (SpreadsheetMenuItem)menuItemCommandAdapter.CreateMenuItem(DevExpress.Utils.Menu.DXMenuItemPriority.Normal); menuItem.BeginGroup = true; e.Menu.Items.Add(menuItem); // Insert a new item into the Spreadsheet popup menu and handle its click event. SpreadsheetMenuItem myItem = new SpreadsheetMenuItem("My Menu Item", new EventHandler(MyClickHandler)); e.Menu.Items.Add(myItem); } }