Skip to content

New APIs to facillitate getting started #1548

@twsouthwick

Description

@twsouthwick

This is a placeholder issue as we revamp some of the docs to identify APIs we should add to better handle common cases that are exposed by nullability analysis. There appears to be a lot of boilerplate to build up a document that requires null checking and then adding parts, etc that we could probably add some helper methods to simplify things.

For example:

Sheets? sheets = workbookPart.Workbook.GetFirstChild<Sheets>();

this could be null, so defensively, we would want something like:

Sheets sheets = workbookPart.Workbook.GetFirstChild<Sheets>() ?? workbookPart.Workbook.AppendChild(new Sheets());

This becomes cumbersome, when we could add something similar to:

Sheets sheets = workbookPart.Workbook.GetFirstChildOrAdd<Sheets>();

Addtional APIs may be helpful here, and so I'm creating this issue to track some of these quality of life related APIs. I think we should also consider identifying patterns for analyzers to catch to move people to these better patterns as well

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions