protected override void RenderBody(ExtendedXlsFile xls) { StartRow = Parent.GetUsedRows() + 1; UsedRows = StartRow; StartCol = NestingLevel; xls.SetCellValue(UsedRows, StartCol, Data.Name); if (StartCol < InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1) { xls.MergeCells(UsedRows, StartCol, UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); } UsedCols = InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1; for (int i = 0; i < InternalData.NumbersValues; i++) { UsedCols++; if (i < Data.InputInterval.Count) { xls.SetCellFloatValue(UsedRows, UsedCols, Data.InputInterval[i].F_VALUE); AddCellToFormula(InternalData.IntervalFormulUids[i].SummInForPs, UsedCols, UsedRows, Data.InputInterval[i].F_VALUE, EnumExcelFormulaOperators.Plus); AddCellToFormula(InternalData.IntervalFormulUids[i].SaldoByTi, UsedCols, UsedRows, Data.InputInterval[i].F_VALUE, EnumExcelFormulaOperators.Plus); MarkFlags(Data.InputInterval[i], xls, UsedCols); MarkFlags(Data.InputInterval[i], xls, UsedCols + 2); } if (i < Data.OutputInterval.Count) { xls.SetCellFloatValue(UsedRows, UsedCols + 1, Data.OutputInterval[i].F_VALUE); AddCellToFormula(InternalData.IntervalFormulUids[i].SummOutForPs, UsedCols + 1, UsedRows, Data.OutputInterval[i].F_VALUE, EnumExcelFormulaOperators.Plus); AddCellToFormula(InternalData.IntervalFormulUids[i].SaldoByTi, UsedCols + 1, UsedRows, Data.OutputInterval[i].F_VALUE, EnumExcelFormulaOperators.Minus); MarkFlags(Data.OutputInterval[i], xls, UsedCols + 1); MarkFlags(Data.OutputInterval[i], xls, UsedCols + 2); } if (i < Data.InputInterval.Count || i < Data.OutputInterval.Count) { xls.SetFormula(UsedRows, UsedCols + 2, GetFormula(InternalData.IntervalFormulUids[i].SaldoByTi)); AddCellToFormula(InternalData.IntervalFormulUids[i].SummSaldoForPs, UsedCols + 2, UsedRows, GetFormula(InternalData.IntervalFormulUids[i].SaldoByTi).DoubleRepresentation(), EnumExcelFormulaOperators.Plus); } UsedCols++; UsedCols++; } }
protected override void RenderBody(ExtendedXlsFile xls) { UsedRows = Parent.GetUsedRows() + 1; StartRow = UsedRows; StartCol = NestingLevel; xls.SetCellValue(UsedRows, StartCol, Data.Name); if (StartCol < InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1) { xls.MergeCells(UsedRows, StartCol, UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); } #region Input foreach (var inputByVolt in Data.InputByVoltages) { double inputValue = inputByVolt.Value.ConvertDataUnitDigitFromWatt(EnumUnitDigit.Kilo).F_VALUE; xls.SetCellFloatValue(UsedRows, InternalData.HeaderInputColumnNumbers[inputByVolt.Key].ColumnNumber, inputValue); //надо добавить в 2 формулы //в input AddCellToFormula(HeaderBal0LogicalParts.InputSumm.GetFormulaUid(), InternalData.HeaderInputColumnNumbers[inputByVolt.Key].ColumnNumber, UsedRows, inputValue, EnumExcelFormulaOperators.Plus); //по подстанции AddCellToFormula(InternalData.HeaderInputColumnNumbers[inputByVolt.Key].FormulaUid, InternalData.HeaderInputColumnNumbers[inputByVolt.Key].ColumnNumber, UsedRows, inputValue, EnumExcelFormulaOperators.Plus); MarkFlags(inputByVolt, xls, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], InternalData.HeaderInputColumnNumbers); } var inputFormula = GetFormula(HeaderBal0LogicalParts.InputSumm.GetFormulaUid()); if (inputFormula.Elements.Count > 0) { xls.SetFormula(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], inputFormula); AddCellToFormula(FormulaNamesEnum.Balance220330InputSummary.GetFormulaUid(), InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], UsedRows, inputFormula.DoubleRepresentation(), EnumExcelFormulaOperators.Plus); AddCellToFormula(HeaderBal0LogicalParts.SaldoSumm.GetFormulaUid(), InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], UsedRows, inputFormula.DoubleRepresentation(), EnumExcelFormulaOperators.Plus); } #endregion Input #region Output foreach (var outputByVolt in Data.OutputByVoltages) { double outputValue = outputByVolt.Value.ConvertDataUnitDigitFromWatt(EnumUnitDigit.Kilo).F_VALUE; xls.SetCellFloatValue(UsedRows, InternalData.HeaderOutputColumnNumbers[outputByVolt.Key].ColumnNumber, outputValue); //надо добавить в 2 формулы //в output AddCellToFormula(HeaderBal0LogicalParts.OutputSumm.GetFormulaUid(), InternalData.HeaderOutputColumnNumbers[outputByVolt.Key].ColumnNumber, UsedRows, outputValue, EnumExcelFormulaOperators.Plus); //по подстанции AddCellToFormula(InternalData.HeaderOutputColumnNumbers[outputByVolt.Key].FormulaUid, InternalData.HeaderOutputColumnNumbers[outputByVolt.Key].ColumnNumber, UsedRows, outputValue, EnumExcelFormulaOperators.Plus); MarkFlags(outputByVolt, xls, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.OutputSumm], InternalData.HeaderOutputColumnNumbers); } var outputFormula = GetFormula(HeaderBal0LogicalParts.OutputSumm.GetFormulaUid()); if (outputFormula.Elements.Count > 0) { xls.SetFormula(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.OutputSumm], outputFormula); AddCellToFormula(FormulaNamesEnum.Balance220330OutputSummary.GetFormulaUid(), InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.OutputSumm], UsedRows, outputFormula.DoubleRepresentation(), EnumExcelFormulaOperators.Plus); AddCellToFormula(HeaderBal0LogicalParts.SaldoSumm.GetFormulaUid(), InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.OutputSumm], UsedRows, outputFormula.DoubleRepresentation(), EnumExcelFormulaOperators.Minus); } #endregion Output #region Saldo var saldoFormula = GetFormula(HeaderBal0LogicalParts.SaldoSumm.GetFormulaUid()); if (saldoFormula.Elements.Count > 0) { xls.SetFormula(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.SaldoSumm], saldoFormula); AddCellToFormula(FormulaNamesEnum.Balance220330SaldoSummary.GetFormulaUid(), InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.SaldoSumm], UsedRows, saldoFormula.DoubleRepresentation(), EnumExcelFormulaOperators.Plus); } #endregion Saldo }
protected override void RenderFooter(ExtendedXlsFile xls) { UsedRows++; xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], "Потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше"), TFlxFontStyles.Bold); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); xls.SetCellValueStyled(UsedRows + 1, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], ("Относительные потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше") + " к отпуску в РСК и потребителям"), TFlxFontStyles.Bold); xls.MergeCells(UsedRows + 1, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows + 1, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); UsedCols = InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1; for (int i = 0; i < InternalData.NumbersValues; i++) { UsedCols++; var lossesFormula = GetFirstLevelFormulas(InternalData.IntervalFormulUids[i].SummBalPartSaldoForLosses); xls.SetFormula(UsedRows, UsedCols, lossesFormula); string relativeLossesFormula; var dividerFormula = GetFirstLevelFormulas(InternalData.IntervalFormulUids[i].SummBalPartSaldoForLossesDivider); if (dividerFormula.Elements.Count > 0) { if (InternalData.ExportType == TExportExcelAdapterType.toXLS) { relativeLossesFormula = "=(" + lossesFormula.StringRepresentation() + ")/(" + dividerFormula.StringRepresentation() + ")*100"; xls.SetCellFloatValue(UsedRows + 1, UsedCols, new TFormula(relativeLossesFormula)); } else { double relativeLosses = lossesFormula.DoubleRepresentation() / dividerFormula.DoubleRepresentation() * 100; xls.SetCellFloatValue(UsedRows + 1, UsedCols, relativeLosses); } } else { xls.SetCellFloatValue(UsedRows + 1, UsedCols, 0.000); } xls.MergeCells(UsedRows, UsedCols, UsedRows, UsedCols + 2); xls.MergeCells(UsedRows + 1, UsedCols, UsedRows + 1, UsedCols + 2); UsedCols++; UsedCols++; } UsedRows++; if (InternalData.FlNoData || InternalData.FlagOVremark || InternalData.FlagManualStatusChange) { UsedRows++; UsedRows++; xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1, "Примечание : ", InternalData.GetFootnoteFormat(xls)); } if (InternalData.FlNoData) { UsedRows++; xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.LightPink); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - нет данных по одной или нескольким точкам измерения"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols); } if (InternalData.FlagOVremark) { UsedRows++; xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.0); xls.SetCellFontColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Red); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - обходной выключатель"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols); } if (InternalData.FlagManualStatusChange) { UsedRows++; xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Yellow); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - вручную установлен некоммерческий статус"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols); } }
protected override void RenderFooter(ExtendedXlsFile xls) { UsedRows++; xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], "Итого по ЕНЕС, кВт*ч", InternalData.GetSectionNameFormat(xls)); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.TotalColumnsCount); UsedRows++; xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], "Всего по объектам ЕНЭС " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "220" : "330") + " кВ и выше", TFlxFontStyles.Bold); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); RenderSummaryBehavior behav = new RenderSummaryBehavior(this, TFlxFontStyles.None); behav.RenderSummary(xls, GetFirstLevelFormulas); UsedRows++; xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], "Потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше"), TFlxFontStyles.Bold); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); var saldoFormula = GetFirstLevelFormulas(FormulaNamesEnum.Balance220330SaldoSummary.GetFormulaUid()); var balPartInRelLosses = GetFirstLevelFormulas(FormulaNamesEnum.Balance220330RelativeLosses.GetFormulaUid()); xls.SetFormula(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], saldoFormula); UsedRows++; xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], ("Относительные потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше") + " к отпуску в РСК и потребителям"), TFlxFontStyles.Bold); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); string relativeLossesFormula; if (balPartInRelLosses.Elements.Count > 0) { if (InternalData.ExportType == TExportExcelAdapterType.toXLS) { relativeLossesFormula = "=(" + saldoFormula.StringRepresentation() + ")/(" + balPartInRelLosses.StringRepresentation() + ")*100"; xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], new TFormula(relativeLossesFormula)); } else { double relativeLosses = saldoFormula.DoubleRepresentation() / balPartInRelLosses.DoubleRepresentation() * 100; xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], relativeLosses); } } else { xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.000); } UsedRows++; xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], "Относительные нормативные потери в сети " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "220" : "330") + "кВ, %", TFlxFontStyles.Bold); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName], UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1); xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Data.HighLimit); UsedRows++; UsedRows++; if (InternalData.FlNoData || InternalData.FlagOVremark || InternalData.FlagManualStatusChange) { UsedRows++; UsedRows++; xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1, "Примечание : ", InternalData.GetFootnoteFormat(xls)); } if (InternalData.FlNoData) { UsedRows++; xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.LightPink); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - нет данных по одной или нескольким точкам измерения"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount); } if (InternalData.FlagOVremark) { UsedRows++; xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.0); xls.SetCellFontColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Red); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - обходной выключатель"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount); } if (InternalData.FlagManualStatusChange) { UsedRows++; xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Yellow); xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - вручную установлен некоммерческий статус"); xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount); } }