Skip to content

Commit

Permalink
include usings in snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeebowen committed Nov 30, 2023
1 parent f935b8c commit aaf4bfe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
// <Snippet0>
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic;
using System.Linq;

List<uint>? items = null;

if (args is [{ } fileName, { } sheetName, { } detectRows])
{
items = GetHiddenRowsOrCols(fileName, sheetName, detectRows);
}
else if (args is [{ } fileName2, { } sheetName2])
{
items = GetHiddenRowsOrCols(fileName2, sheetName2);
}

if (items is null)
{
throw new ArgumentException("Invalid arguments.");
}

foreach (uint item in items)
{
Console.WriteLine(item);
}
// <Snippet0>
static List<uint> GetHiddenRowsOrCols(string fileName, string sheetName, string detectRows = "false")
{
// Given a workbook and a worksheet name, return
Expand Down Expand Up @@ -98,3 +78,24 @@ static List<uint> GetHiddenRowsOrCols(string fileName, string sheetName, string
return itemList;
}
// </Snippet0>

List<uint>? items = null;

if (args is [{ } fileName, { } sheetName, { } detectRows])
{
items = GetHiddenRowsOrCols(fileName, sheetName, detectRows);
}
else if (args is [{ } fileName2, { } sheetName2])
{
items = GetHiddenRowsOrCols(fileName2, sheetName2);
}

if (items is null)
{
throw new ArgumentException("Invalid arguments.");
}

foreach (uint item in items)
{
Console.WriteLine(item);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
' <Snippet0>
Imports DocumentFormat.OpenXml.Packaging
Imports DocumentFormat.OpenXml.Spreadsheet

Expand All @@ -6,7 +7,6 @@ Module Program
End Sub


' <Snippet0>
Public Function GetHiddenRowsOrCols(
ByVal fileName As String, ByVal sheetName As String,
ByVal detectRows As Boolean) As List(Of UInteger)
Expand Down Expand Up @@ -67,5 +67,6 @@ Module Program
End Using
Return itemList
End Function
' </Snippet0>
End Module
End Module

' </Snippet0>

0 comments on commit aaf4bfe

Please sign in to comment.