/// <summary> /// Добавить строку со значениями. /// </summary> /// <param name="row">Номер строки.</param> /// <param name="columnsCount">Количество колонок в области значений.</param> /// <param name="startColumn">Начальная колонка, для области значений.</param> static private void WriteDataRow(int row, int columnsCount, int startColumn) { int indexColumn = startColumn; for (int col = 0; col < columnsCount; col++) { CellData cell = pivotDataProvider.Provider.CellSet_Description.GetCellDescription(col, row); CellValueData valueData = cell.Value; string color = string.Empty; object backColor = valueData.GetPropertyValue("BACK_COLOR"); if (backColor != null) { int colorARGB = Convert.ToInt32(backColor); int colorOLE = ColorTranslator.ToOle(Color.FromArgb(colorARGB)); color = "#" + Color.FromArgb(colorOLE).Name; } string value = string.Empty; string type = "String"; if (valueData.Value != null) { type = GetTypeForExcel(valueData.Value); value = valueData.Value.ToString(); value = value.Replace(',', '.'); } string numberFormate = string.Empty; if (valueData.GetPropertyValue("FORMAT_STRING") != null) { numberFormate = valueData.GetPropertyValue("FORMAT_STRING").ToString(); } if (numberFormate == "Currency" || (String.IsNullOrEmpty(numberFormate) && type == "Number")) { numberFormate = GetNumberFormat(valueData.DisplayValue); } string styleId = defaultStyle; if (valueData.Value != null) { styleId = FindStyle(color, numberFormate, !cell.Value.CanUpdate); } if (string.IsNullOrEmpty(styleId)) { styleId = "Style" + row + col; AddStyle(styleId, color, numberFormate, !cell.Value.CanUpdate, true, fontTahoma8); } WriteCell(value, type, styleId, indexColumn, false); indexColumn++; } }