Skip to content

Commit

Permalink
make recommended changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeebowen committed Nov 1, 2023
1 parent ec2b10f commit 06a0984
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions samples/presentation/retrieve_the_number_of_slides/cs/Program.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using DocumentFormat.OpenXml.Packaging;
using System;
using System.IO.Enumeration;
using System.Linq;

if (args.Length >= 2)
if (args is [ { } fileName, {} includeHidden])
{
RetrieveNumberOfSlides(args[0], args[1]);
RetrieveNumberOfSlides(fileName, includeHidden);
}
else
else if (args is [{ } fileName2])
{
RetrieveNumberOfSlides(args[0]);
RetrieveNumberOfSlides(fileName2);
}

static int RetrieveNumberOfSlides(string fileName,
string includeHidden = "true")
static int RetrieveNumberOfSlides(string fileName, string includeHidden = "true")
{
int slidesCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Collections.Generic;
using System.Linq;

if (args.Length >= 3)
if (args is [{ } fileName, { } sheetName, { } detectRows])
{
GetHiddenRowsOrCols(args[0], args[1], args[2]);
GetHiddenRowsOrCols(fileName, sheetName, detectRows);
}
else
else if (args is [{ } fileName2, { } sheetName2])
{
GetHiddenRowsOrCols(args[0], args[1]);
GetHiddenRowsOrCols(fileName2, sheetName2);
}

static List<uint> GetHiddenRowsOrCols(string fileName, string sheetName, string detectRows = "false")
Expand Down
8 changes: 4 additions & 4 deletions samples/word/extract_styles/cs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
using System.Xml;
using System.Xml.Linq;

if (args.Length >= 2)
if (args is [{ } fileName, { } getStyleWithEffectsPart])
{
ExtractStylesPart(args[0], args[1]);
ExtractStylesPart(fileName, getStyleWithEffectsPart);
}
else
else if (args is [{ } fileName2])
{
ExtractStylesPart(args[0]);
ExtractStylesPart(fileName2);
}

// Extract the styles or stylesWithEffects part from a
Expand Down
2 changes: 1 addition & 1 deletion samples/word/retrieve_comments/cs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static void GetCommentsFromDocument(string fileName)
{
if (wordDoc.MainDocumentPart is null || wordDoc.MainDocumentPart.WordprocessingCommentsPart is null)
{
throw new System.NullReferenceException("MainDocumentPart and/or WordprocessingCommentsPart is null.");
throw new System.InvalidOperationException("MainDocumentPart and/or WordprocessingCommentsPart is null.");
}

WordprocessingCommentsPart commentsPart = wordDoc.MainDocumentPart.WordprocessingCommentsPart;
Expand Down

0 comments on commit 06a0984

Please sign in to comment.