Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FontName becomes OpenXmlUnknownElement #1792

Open
andrewtsybulia opened this issue Sep 17, 2024 · 1 comment
Open

FontName becomes OpenXmlUnknownElement #1792

andrewtsybulia opened this issue Sep 17, 2024 · 1 comment
Assignees

Comments

@andrewtsybulia
Copy link

andrewtsybulia commented Sep 17, 2024

Hi team
Describe the bug
After updating to version 3.1.0, I've encountered a bug. When I create a DocumentFormat.OpenXml.Spreadsheet.RunProperties with FontName as a child element, it changes the FontName to OpenXmlUnknownElement.

Screenshots
image

To Reproduce

using System.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using Xunit;

namespace SOME_NAME_SPACE;

public class ExcelConvertingHelperTests
{
    [Fact]
    public void BuildFont_Should_Return_RunProperties_With_FontName()
    {
        // Arrange
        var runProps = new RunProperties(new FontName());
        var spreadsheetDocument = SpreadsheetDocument.Create($"SampleWithRunProperties.xlsx", SpreadsheetDocumentType.Workbook);
        var workbookPart = spreadsheetDocument.AddWorkbookPart();
        var worksheetPart = workbookPart.AddNewPart<WorksheetPart>();
        worksheetPart.Worksheet = new Worksheet(new SheetData(new Row(new Cell(new InlineString(new Run(runProps))))));
        workbookPart.Workbook = new Workbook(new Sheets(new Sheet()));
        spreadsheetDocument.Save();

        // Act
        var result = worksheetPart.Worksheet.Descendants<RunProperties>().First().FirstChild;

        // Assert
        Assert.True(result is FontName);
        Assert.True(result is not OpenXmlUnknownElement);

        spreadsheetDocument.Dispose();
    }
}
  1. Run the test
  2. See error

Expected behavior
FontName becomes OpenXmlUnknownElement, I expect it to stay FontName.

Desktop (please complete the following information):

  • OS: Windows 11 Enterprise 23H2
  • .NET Target: .Net 8.0
  • DocumentFormat.OpenXml Version: 3.1.0
@rettoua
Copy link

rettoua commented Nov 5, 2024

any thoughts on that ? @twsouthwick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants