private void печатьToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Файлы Excel | *.xls"; if ((dialog.ShowDialog() == DialogResult.OK) && this.Таблица.IsPrintingAvailable) { this.Таблица.ExportToXls(dialog.FileName, new XlsExportOptions(true, true)); ОткрытиеФайлов.ОткрытьФайл(dialog.FileName); } }
private void пунктМенюПечать_Нажатие(object отправитель, АргументыСобытия аргументы) { if (((отправитель == null) || !(отправитель is ToolStripMenuItem)) || ((отправитель as ToolStripMenuItem).Tag == null)) { return; } string str = (отправитель as ToolStripMenuItem).Tag.ToString().Trim().ToLower(); string tempFileName = Path.GetTempFileName(); this.КурсорОжидания(); try { try { string str3 = str; if (str3 != null) { if (!(str3 == "excel")) { if (str3 == "html") { goto Label_00D0; } if (str3 == "rtf") { goto Label_00DF; } if (str3 == "pdf") { goto Label_00FA; } } else { tempFileName = tempFileName + ".xls"; ExportXlsProvider provider = new ExportXlsProvider(tempFileName); GridViewExportLink link = this.данныеТаблицыИстории.CreateExportLink(provider) as GridViewExportLink; link.ExportCellsAsDisplayText = false; link.ExportTo(true); } } goto Label_013E; Label_00D0: this.таблицаИстории.ExportToHtml(tempFileName); goto Label_013E; Label_00DF: tempFileName = tempFileName + ".rtf"; this.таблицаИстории.ExportToRtf(tempFileName); goto Label_013E; Label_00FA: tempFileName = tempFileName + ".pdf"; this.таблицаИстории.ExportToPdf(tempFileName); } catch (Exception exception) { Сообщение.ПоказатьИсключительнуюСитуацию("Ошибка печати таблицы истории сборки.", exception); tempFileName = ""; } } finally { this.ОбычныйКурсор(); } Label_013E: if (!(string.IsNullOrEmpty(tempFileName) || !File.Exists(tempFileName))) { ОткрытиеФайлов.ОткрытьФайл(tempFileName); } }