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

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

Open
prudentcircle opened this issue Sep 18, 2024 · 1 comment
Open
Labels
confirmed-bug Issues with confirmed bugs

Comments

@prudentcircle
Copy link

prudentcircle commented Sep 18, 2024

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

@lemonowl
Copy link

lemonowl commented Oct 8, 2024

Hello @prudentcircle, I have registered a bug in our private bug tracker #70752

@Rita-Bubnova Rita-Bubnova added the confirmed-bug Issues with confirmed bugs label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs
Projects
None yet
Development

No branches or pull requests

3 participants