Skip to content

Commit

Permalink
[Add] catching exception on AdjustToContents to fonts not being avail…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
sam.gerene committed Nov 14, 2022
1 parent dc19912 commit 0d79406
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions NetProjectPackageExtractor/Services/PackageToExcelWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ private static void AddLibrariesSheet(IEnumerable<Package> packages, XLWorkbook
dataTable.Rows.Add(dataRow);
}

var table = pivotWorksheet.Cell(1, 1).InsertTable(dataTable, "Libraries", true);
pivotWorksheet.Rows().AdjustToContents();
pivotWorksheet.Columns().AdjustToContents();

pivotWorksheet.Cell(1, 1).InsertTable(dataTable, "Libraries", true);

try
{
pivotWorksheet.Rows().AdjustToContents();
pivotWorksheet.Columns().AdjustToContents();
}
catch (Exception e)
{
Console.WriteLine("Problem loading fonts {0}", e);
}
}

/// <summary>
Expand All @@ -146,9 +152,17 @@ private static void AddNugetSheet(IEnumerable<Package> packages, XLWorkbook work
.ThenBy(x => x.ProjectName);

var nugetWorksheet = workbook.Worksheets.Add("NuGet Packages");
var table = nugetWorksheet.Cell(1, 1).InsertTable(nugetPackageData.AsEnumerable(), "NugetPackages", true);
nugetWorksheet.Rows().AdjustToContents();
nugetWorksheet.Columns().AdjustToContents();
nugetWorksheet.Cell(1, 1).InsertTable(nugetPackageData.AsEnumerable(), "NugetPackages", true);

try
{
nugetWorksheet.Rows().AdjustToContents();
nugetWorksheet.Columns().AdjustToContents();
}
catch (Exception e)
{
Console.WriteLine("Problem loading fonts {0}", e);
}

foreach (var wsrow in nugetWorksheet.Rows().Skip(1))
{
Expand Down

0 comments on commit 0d79406

Please sign in to comment.