Skip to content

Commit

Permalink
Use index instead of count for variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
Discolai committed Jan 25, 2024
1 parent e98e8a5 commit 26479c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ private void GenerateSheetByIDataReader(MiniExcelStreamWriter writer, IDataReade
writer.Write($@"<?xml version=""1.0"" encoding=""utf-8""?><x:worksheet xmlns:x=""http://schemas.openxmlformats.org/spreadsheetml/2006/main"">");
var xIndex = 1;
var yIndex = 1;
var maxColumnCount = 0;
var maxRowCount = 0;
var maxColumnIndex = 0;
var maxRowIndex = 0;
{

if (_configuration.FastMode)
Expand All @@ -637,7 +637,7 @@ private void GenerateSheetByIDataReader(MiniExcelStreamWriter writer, IDataReade
var prop = GetColumnInfosForIDataReader(columnName);
props.Add(prop);
}
maxColumnCount = props.Count;
maxColumnIndex = props.Count;

WriteColumnsWidths(writer, props);

Expand All @@ -664,17 +664,17 @@ private void GenerateSheetByIDataReader(MiniExcelStreamWriter writer, IDataReade
}

// Subtract 1 because cell indexing starts with 1
maxRowCount = yIndex - 1;
maxRowIndex = yIndex - 1;
}
writer.Write("</x:sheetData>");
if (_configuration.AutoFilter)
writer.Write($"<x:autoFilter ref=\"{GetDimensionRef(maxRowCount, maxColumnCount)}\" />");
writer.Write($"<x:autoFilter ref=\"{GetDimensionRef(maxRowIndex, maxColumnIndex)}\" />");
writer.WriteAndFlush("</x:worksheet>");

if (_configuration.FastMode)
{
writer.SetPosition(dimensionWritePosition);
writer.WriteAndFlush($@"{GetDimensionRef(maxRowCount, maxColumnCount)}""");
writer.WriteAndFlush($@"{GetDimensionRef(maxRowIndex, maxColumnIndex)}""");
}
}

Expand Down

0 comments on commit 26479c3

Please sign in to comment.