Bold not applied

Hi,


In the attached document there is a Shape with the text “Decision-Making Flowchart” that is bolded. I cleared that Shape and added new text but I was unable to set that text to be bold. Can you please check this out?

Thanks,
Zeljko

Code:

public void asposeTest() throws Exception {
Diagram diagram = new Diagram(“Test.vdx”);
ShapeCollection shapes = diagram.getPages().get(0).getShapes();
Shape shape = shapes.get(shapes.getCount() - 1);
shape.getText().getValue().clear();
shape.getChars().clear();
shape.getText().getValue().add(new Cp(0));
FormatTxt txt = new Txt(“New text”);
shape.getText().getValue().add(txt);
Char shapeChar = new Char();
shapeChar.getStyle().setValue(StyleValue.BOLD);
shape.getChars().add(shapeChar);
diagram.save("/home/emisia/Desktop/TestXX.vdx",SaveFileFormat.VDX);
}

Hi Zeljko,


Thank you for contacting support. Please modify your sample code as below:
[Java]
public void asposeTest() throws Exception {
Diagram diagram = new Diagram(“Test.vdx”);
ShapeCollection shapes = diagram.getPages().get(0).getShapes();
Shape shape = shapes.get(shapes.getCount() - 1);
shape.getText().getValue().clear();
shape.getChars().clear();
shape.getText().getValue().add(new Cp(0));
FormatTxt txt = new Txt(“New text”);
shape.getText().getValue().add(txt);
Char shapeChar = new Char();
shapeChar.setIX(0);
shapeChar.getStyle().setValue(StyleValue.BOLD);
shape.getChars().add(shapeChar);
diagram.save("/home/emisia/Desktop/TestXX.vdx",SaveFileFormat.VDX);
}

Hi,


When I run the code below, using the same file, bold is lost. This happens when highlighted lines of code are executed. Do you know why? Why is this affecting Char’s Style?

Thanks,
Zeljko

Code:
public void asposeTest() throws Exception {
Diagram diagram = new Diagram(“Test.vdx”);
ShapeCollection shapes = diagram.getPages().get(0).getShapes();
Shape shape = shapes.get(shapes.getCount() - 1);
shape.getText().getValue().clear();
shape.getText().getValue().add(new Cp(0));
FormatTxt txt = new Txt(“New text”);
shape.getText().getValue().add(txt);
Char ch = shape.getChars().get(0);
ch.getSize().getUfe().setF("");
ch.getFont().getUfe().setF("");
ch.getFontScale().getUfe().setF("");
diagram.save(“TestXX.vdx”, SaveFileFormat.VDX);
}

Hi Zeljko,


Thank you for supplying the source code. We have tested your Visio diagram and code against the latest version 6.2.0 of Aspose.Diagram for Java API. The text of the shape is bold on our side. We have attached the output VDX for your kind reference. Please download and use the latest version 6.2.0 and let us know how that goes on your side.

Hi,


I just opened your output file and the text is not bolded, please see the screenshot. I am using Microsoft Visio Profesional 2013.

Thanks,
Zeljko

Hi Zeljko,


Thank you for the details. I’m also using Microsoft Office Visio Professional 2013 and it shows bold text on my side. Please check my attached screenshots to this reply. Please provide details of your working environment, e.g. Operating System (name and edition like Windows 7 Professional 64 bits), MS Visio build number, and any other information which you think is necessary to replicate the problem on our side. Meanwhile, please also test on another computer and let us know your findings.

Hi,

I ran the tests again and apparently bold is lost when I execute ch.getFont().getUfe().setF(“”);

I found this thread where you said that if Values for Font, Scale and Size are being set and new Char is being created then these three lines should be executed ch.getSize().getUfe().setF(“”); ch.getFont().getUfe().setF(“”); ch.getFontScale().getUfe().setF(“”); Is there a possibility that this should not be done on the existing Char like in the example below?

Thanks,
Zeljko




Code:
public void asposeTest() throws Exception {
Diagram diagram = new Diagram(“Test.vdx”);
ShapeCollection shapes = diagram.getPages().get(0).getShapes();
Shape shape = shapes.get(shapes.getCount() - 1);
shape.getText().getValue().clear();
shape.getText().getValue().add(new Cp(0));
FormatTxt txt = new Txt(“New text”);
shape.getText().getValue().add(txt);
Char ch = shape.getChars().get(0);
ch.getFont().getUfe().setF(“”);
diagram.save(“TestXX.vdx”, SaveFileFormat.VDX);
}

Hi Zeljko,


Thank you for the inquiry. We have narrated in our earlier post that the shape’s text is bold on our side. Based on your reply when you opened our output VDX file in your working environment, then the shape text was not bold. It clearly states that there is some difference in both your and our working environment. We need to investigate and find out the difference. The referenced thread does not duplicate the same scenario because the customer was assigning Char properties to the new ones. However, there is no effect of this on the text boldness and you can skip this line.