public void GenerateWorksheetName(string pageName) { if (!string.IsNullOrEmpty(pageName)) { StringBuilder stringBuilder = ExcelGeneratorStringUtil.SanitizeSheetName(pageName); if (stringBuilder.Length != 0) { pageName = stringBuilder.ToString(); int num = 0; while (true) { if (!this._worksheetNames.TryGetValue(pageName.ToUpperInvariant(), out num) && !this.CheckForSheetNameConflict(pageName)) { break; } num++; this._worksheetNames[pageName.ToUpperInvariant()] = num; string text = string.Format(CultureInfo.InvariantCulture, ExcelRenderRes.SheetNameCounterSuffix, num); if (pageName.Length + text.Length > 31) { pageName = pageName.Remove(31 - text.Length); } pageName += text; } this._currentSheet.Name = pageName; this._worksheetNames.Add(pageName.ToUpperInvariant(), 1); } } }
public void GenerateWorksheetName(string pageName) { if (string.IsNullOrEmpty(pageName)) { return; } StringBuilder stringBuilder = ExcelGeneratorStringUtil.SanitizeSheetName(pageName); if (stringBuilder.Length == 0) { return; } pageName = stringBuilder.ToString(); int value = 0; while (m_worksheetNames.TryGetValue(pageName.ToUpperInvariant(), out value) || CheckForSheetNameConflict(pageName)) { value++; m_worksheetNames[pageName.ToUpperInvariant()] = value; string text = string.Format(CultureInfo.InvariantCulture, ExcelRenderRes.SheetNameCounterSuffix, value); if (pageName.Length + text.Length > 31) { pageName = pageName.Remove(31 - text.Length); } pageName += text; } m_worksheet.SheetName = pageName; m_worksheetNames.Add(pageName.ToUpperInvariant(), 1); }
public void AdjustFirstWorksheetName(string reportName, bool addedDocMap) { if (!string.IsNullOrEmpty(reportName)) { Streamsheet streamsheet = null; if (addedDocMap) { if (this._workbook.Worksheets.Count >= 2) { streamsheet = this._workbook[1]; } } else if (this._workbook.Worksheets.Count >= 1) { streamsheet = this._workbook[0]; } if (streamsheet != null) { streamsheet.Name = ExcelGeneratorStringUtil.SanitizeSheetName(reportName).ToString(); } } }