private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { SpreadsheetExample example = treeList1.GetDataRecordByNode(treeList1.FocusedNode) as SpreadsheetExample; if (example == null) { return; } EnableButtons(example.Name); }
void RunExample(string filePath, XlDocumentFormat documentFormat) { SpreadsheetExample example = treeList1.GetDataRecordByNode(treeList1.FocusedNode) as SpreadsheetExample; if (example == null) { return; } using (FileStream stream = new FileStream(filePath, FileMode.Create)) { Action <Stream, XlDocumentFormat> action = example.Action; action(stream, documentFormat); } Process.Start(filePath); }