Skip to content

CreateShape with type "line" causes expected error when building #143

@prudentcircle

Description

@prudentcircle

Describe your problem:

Api.CreateShape with "line" as a parameter causes errors when buliding a PPTX document.

Be clear in your description of the problem.
Open an issue with a descriptive title and a summary in complete sentences.

I used below Docubuilder code to try to generate a PPTX document.

var oFill = Api.CreateNoFill();
var oRGBColor = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, oFill);
var oShapeLine = Api.CreateShape("line", 25.4*36000, 1*36000, oRGBColor, oStroke);
oShapeLine.SetPosition(0, 748800);
oSlide.AddObject(oShapeLine);

The process errors out when executing the following step

oSlide.AddObject(oShapeLine);

However, the error goes away when I try to create Shape of "rect".
In the API documentation, there is difference between "Line" and "Rect" in terms of what argument you have to use.
However, in real life, using "line" errors out with the same arguments.

Use the template below when reporting bugs. Please, make sure that
you're running the latest stable DocumentBuilder and that the problem you're reporting
hasn't been reported (and potentially fixed) already.

Before filing the ticket you should replace all cursive text with your own words.

Steps to reproduce the problem:

Create a docubuilder file with the following content

builder.CreateFile("pptx");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
var oFill = Api.CreateNoFill();
var oStroke = Api.CreateStroke(0, oFill);
var oShapeTitle = Api.CreateShape("rect", 127.1* 36000, 9.4* 36000, oFill, oStroke );
oShapeTitle.SetPosition(266400, 266800);
var oDocContent = oShapeTitle.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
oParagraph.RemoveAllElements();
var oRun = Api.CreateRun();
var oTextPr = oRun.GetTextPr();
oRun.AddText("test-title");
oTextPr.SetFontSize(32);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
oTextPr.SetFill(oFill);
oTextPr.SetFontFamily("Malgun Gothic");
oParagraph.AddElement(oRun);
oParagraph.SetBold(true);
oParagraph.SetJc("center");
oSlide.AddObject(oShapeTitle);

var oFill = Api.CreateNoFill();
var oRGBColor = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, oFill);
var oShapeLine = Api.CreateShape("line", 25.4*36000, 1*36000, oRGBColor, oStroke);
oShapeLine.SetPosition(0, 748800);
oSlide.AddObject(oShapeLine);

Api.Save();
builder.SaveFile("pptx", "test_file.pptx");
builder.CloseFile();

DocumentBuilder version:

8.1.0 on aarch64

Installation method:

DEB package

Operating system:

Debian 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugsfixed-releaseIssues that fixed on next release, waiting to be released

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions