/// <summary> /// Resets the formula engine to an empty state /// </summary> /// <remarks> /// Use this function when you need to reset the formula engine to an empty state. This function will remove all: /// formulas, dependencies, /// references, and sheets from the engine. It will <b>not</b> clear the function library. You should call that /// class' /// <see cref="M:ciloci.FormulaEngine.FunctionLibrary.Clear(System.Boolean)" /> method if you also want to remove all /// formulas. /// </remarks> public void Clear() { // Clear everything but functions DependencyManager.Clear(); ReferencePool.Clear(); _referenceFormulaMap.Clear(); Sheets.Clear(); }
/// <summary> /// 初始化Fp。 /// </summary> /// <param name="report">报表实体。</param> public void Init(Report report) { this.report = report; //获取报表样样式,判定是否可以编辑报表列。对于网格报表这样的样式,是可以编辑列的。对于交叉报表,是不能编辑列的。 BaseReportStyle reportStyle = this.report.ReportStyle; canEditColumn = reportStyle.CanEditColumn(); Sheets.Clear(); Sheets.Add(sheetMain); InitFP(); }
/// <summary> /// Load txt file to ExcelBook /// </summary> /// <param name="stream">txt stream</param> /// <param name="sheetName">The sheet name of ExcelBook</param> public void LoadTxt(Stream stream, string sheetName) { // ensure we have _tabs this.ApplyTemplate(); // de-select and clear tabs Sheets.Clear(); this.ItemsSource = null; string txt = string.Empty; stream.Position = 0; using (StreamReader reader = new StreamReader(stream)) { txt = reader.ReadToEnd(); } if (txt.Length > 0) { Rows.Clear(); Columns.Clear(); string newText = txt.Replace("\r\n", "\r"); // remove trailing break if any (Excel always adds one) if (newText[newText.Length - 1] == '\r') { newText = newText.Substring(0, newText.Length - 1); } var lines = newText.Split('\r', '\n'); int rowCount = lines.Length; if (rowCount <= 0) { return; } int colCount = lines[0].Split('\t').Length; this.AddSheet("temp", rowCount, colCount); Sheets.SelectedSheet.SheetName = sheetName; CellRange rang = new CellRange(0, 0, rowCount - 1, colCount - 1); SetClipString(txt, rang, ClipboardCopyMode.None); } }
/// <summary> /// Load simple CSV file to ExcelBook /// </summary> /// <param name="stream">CSV stream</param> /// <param name="sheetName">The sheet name of ExcelBook</param> public void LoadCsv(Stream stream, string sheetName, string separator = null) { // ensure we have _tabs this.ApplyTemplate(); // de-select and clear tabs Sheets.Clear(); this.ItemsSource = null; C1XLBook l = new C1XLBook(); l.ListSeparator = separator; l.Load(stream, C1.WPF.Excel.FileFormat.Csv, false); if (l.Sheets.Count>0) { var sheet = l.Sheets[0]; this.AddSheet("temp", sheet.Rows.Count, sheet.Columns.Count); Sheets.SelectedSheet.SheetName = sheetName; int rowCount = sheet.Rows.Count; int columnCount = sheet.Columns.Count; for (int r = 0; r < rowCount; r++) { for (int c = 0; c < Columns.Count; c++) { var cell = sheet[r, c]; if (cell != null) { if (cell.Value != null) { // save value this[r, c] = cell.Value; } } } } } }
/// <summary> /// Load excel file to ExcelBook /// </summary> /// <param name="stream">Excel stream</param> /// <param name="fileFormat"> fileformat of excel, support .xlsx and .xls</param> public void LoadExcel(Stream stream, Excel.FileFormat fileFormat) { // ensure we have _tabs this.ApplyTemplate(); // de-select and clear tabs Sheets.Clear(); this.ItemsSource = null; // load the stream var book = new C1XLBook(); book.Load(stream, fileFormat); // load each sheet foreach (XLSheet xlSheet in book.Sheets) { Sheets.Add(new Sheet(xlSheet)); } // select the first tab if (Sheets.Count > 0) { Sheets.SelectedIndex = 0; } }
public void reset() { Sheets.Clear(); }
void Forms_SubTable_SubTable_ѕри»нициализации—траницы(object ќтправитель, Ѕарс.»нтерфейс.јргументы—обыти¤ јргументы) { string —убтаблица = string.Empty; string »дентификатор‘ормы = string.Empty; string »м¤ѕеременной = string.Empty; if (ѕараметры√лавногоќкна.ѕараметр«адан("Params")) { —убтаблица = ѕараметры√лавногоќкна["Params"]; } if (ѕараметры√лавногоќкна.ѕараметр«адан("SessionParam")) { string SessionParam = ѕараметры√лавногоќкна["SessionParam"]; string[] SessionParams = SessionParam.Split(':'); »дентификатор‘ормы = SessionParams[0]; »м¤ѕеременной = SessionParams[1]; } if (string.IsNullOrEmpty(—убтаблица) || string.IsNullOrEmpty(»дентификатор‘ормы) || string.IsNullOrEmpty(»м¤ѕеременной)) { return; } отчетнऑорма = (ќтчетнऑормаƒанных)ћенеджер—ессионныхѕеременных.ѕолучитьѕеременную»з—ессии(»дентификатор‘ормы, »м¤ѕеременной); this.абор“аблиц‘ормы_субтаблица.Sheets.Clear(); ƒинамическओаблица таблица = «агрузить“аблицу(отчетнऑорма, —убтаблица, »дентификатор‘ормы); if (таблица != null) { this.абор“аблиц‘ормы_субтаблица.ƒобавить“аблицу(таблица); } if (таблица.“аблицаћетаструктуры != null) { if (!string.IsNullOrEmpty(таблица.аименование)) { this.«аголовок—траницы = таблица.аименование; } if (!string.IsNullOrEmpty(таблица.“аблицаћетаструктуры.аименование)) { this.«аголовок—траницы = таблица.“аблицаћетаструктуры.аименование; } else { this.«аголовок—траницы = —убтаблица; } } else { this.«аголовок—траницы = —убтаблица; } if (отчетнऑорма.¬ариантќткрыти¤Ёкранной‘ормы == Ѕарс.—воды.ќтчетнऑорма.¬ариантќткрыти¤Ёкранной‘ормы.„тение) { RadMenuItem1.Visible = false; RadMenuItem2.Visible = false; нопка_ќ .Visible = false; нопка_ѕересчитать.Visible = false; }
private void InitLoading(TBaseRecordLoader RecordLoader, TProtection Protection) { Loaded = false; Sheets.Clear(); Globals.Clear(); }