Selaa lähdekoodia

Autofit and font-size fix.

master
NikolaJovanovic 3 vuotta sitten
vanhempi
commit
bd434c8822

BIN
.vs/ClockifyReport/DesignTimeBuild/.dtbcache.v2 Näytä tiedosto


BIN
.vs/ClockifyReport/FileContentIndex/8b10d275-bcfb-4ac6-a641-eb7373191b35.vsidx Näytä tiedosto


BIN
.vs/ClockifyReport/FileContentIndex/d0b5dbec-8f69-424a-9ec8-012448adc627.vsidx Näytä tiedosto


BIN
.vs/ClockifyReport/v17/.suo Näytä tiedosto


BIN
.vs/ProjectEvaluation/clockifyreport.metadata.v2 Näytä tiedosto


BIN
.vs/ProjectEvaluation/clockifyreport.projects.v2 Näytä tiedosto


+ 18
- 12
ClockifyReport/Business/ReportGenerator.cs Näytä tiedosto

for (int i = 0; i < sectionNames.Length; i++) for (int i = 0; i < sectionNames.Length; i++)
{ {
ws.Range[row, i + 1].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, i + 1].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, i + 1].Style.Font.Size = 240;
ws.Range[row, i + 1].Style.Font.Size = 12;
ws.Range[row, i + 1].Value = sectionNames[i]; ws.Range[row, i + 1].Value = sectionNames[i];
ws.Range[row, i + 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, i + 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, i + 1].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thick; ws.Range[row, i + 1].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thick;
foreach (var reportPerson in reportObject.groupOne) foreach (var reportPerson in reportObject.groupOne)
{ {
ws.Range[row, 1].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 1].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 1].Style.Font.Size = 200;
ws.Range[row, 1].Style.Font.Size = 10;
ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 1].Value = reportPerson.name; ws.Range[row, 1].Value = reportPerson.name;


time = TimeSpan.FromSeconds(reportPerson.duration); time = TimeSpan.FromSeconds(reportPerson.duration);
var sumOfRecordHours = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(time.TotalHours), time.Minutes, time.Seconds); var sumOfRecordHours = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(time.TotalHours), time.Minutes, time.Seconds);
ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 3].Style.Font.Size = 200;
ws.Range[row, 3].Style.Font.Size = 10;
ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 3].Value = sumOfRecordHours; ws.Range[row, 3].Value = sumOfRecordHours;


ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 4].Style.Font.Size = 200;
ws.Range[row, 4].Style.Font.Size = 10;
ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
var userDecimalHours = Convert.ToDecimal(TimeSpan.FromSeconds(reportPerson.duration).TotalHours).ToString("0.00"); ; var userDecimalHours = Convert.ToDecimal(TimeSpan.FromSeconds(reportPerson.duration).TotalHours).ToString("0.00"); ;
ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;


ws.Range[row, 2].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 2].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 2].Style.Font.Size = 200;
ws.Range[row, 2].Style.Font.Size = 10;
ws.Range[row, 2].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 2].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 2].Value = personRecord.name; ws.Range[row, 2].Value = personRecord.name;


ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 3].Style.Font.Size = 200;
ws.Range[row, 3].Style.Font.Size = 10;
ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
t = TimeSpan.FromSeconds(personRecord.duration); t = TimeSpan.FromSeconds(personRecord.duration);
ws[row, 3].Value = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(t.TotalHours), t.Minutes, t.Seconds); ws[row, 3].Value = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(t.TotalHours), t.Minutes, t.Seconds);


ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 4].Style.Font.Size = 200;
ws.Range[row, 4].Style.Font.Size = 10;
ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 4].Value = Convert.ToDecimal(TimeSpan.FromSeconds(personRecord.duration).TotalHours).ToString("0.00"); ws.Range[row, 4].Value = Convert.ToDecimal(TimeSpan.FromSeconds(personRecord.duration).TotalHours).ToString("0.00");
var totalSum = reportObject.totals.Select(total => total.totalTime).FirstOrDefault(); var totalSum = reportObject.totals.Select(total => total.totalTime).FirstOrDefault();


ws.Range[row, 1].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 1].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 1].Style.Font.Size = 200;
ws.Range[row, 1].Style.Font.Size = 10;
ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 1].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 1].Value = "Total"; ws.Range[row, 1].Value = "Total";


ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 3].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 3].Style.Font.Size = 200;
ws.Range[row, 3].Style.Font.Size = 10;
ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 3].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 3].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
time1 = t = TimeSpan.FromSeconds(totalSum); time1 = t = TimeSpan.FromSeconds(totalSum);
ws.Range[row, 3].Value = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(time1.TotalHours), time1.Minutes, time1.Seconds); ws.Range[row, 3].Value = string.Format("{0:00}:{1:D2}:{2:D2}", Math.Floor(time1.TotalHours), time1.Minutes, time1.Seconds);


ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans"; ws.Range[row, 4].Style.Font.FontName = "DejaVu Sans";
ws.Range[row, 4].Style.Font.Size = 200;
ws.Range[row, 4].Style.Font.Size = 10;
ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right; ws.Range[row, 4].Style.HorizontalAlignment = HorizontalAlignType.Right;
ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin; ws.Range[row, 4].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
ws.Range[row, 4].Value = Convert.ToDecimal(TimeSpan.FromSeconds(totalSum).TotalHours).ToString("0.00"); ws.Range[row, 4].Value = Convert.ToDecimal(TimeSpan.FromSeconds(totalSum).TotalHours).ToString("0.00");
foreach (var sheet in excelFile.Worksheets) foreach (var sheet in excelFile.Worksheets)
{ {
var columnCount = sheet.Columns.Count(); var columnCount = sheet.Columns.Count();

for (int i = 1; i < columnCount; i++) for (int i = 1; i < columnCount; i++)
{ {
sheet.Columns[i].AutoFitRows();
sheet.AutoFitColumn(i);
} }

var rowCount = sheet.Rows.Count();
for (int i = 1; i < rowCount; i++)
{
sheet.AutoFitRow(i);
}

} }
} }
} }

+ 0
- 1
ClockifyReport/ClockifyReport.csproj Näytä tiedosto

<PackageReference Include="System.Core" Version="3.5.21022.801" /> <PackageReference Include="System.Core" Version="3.5.21022.801" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" /> <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IO.Packaging" Version="6.0.0" /> <PackageReference Include="System.IO.Packaging" Version="6.0.0" />
<PackageReference Include="System.Windows.Forms" Version="4.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="host.json"> <None Update="host.json">

Loading…
Peruuta
Tallenna