Problem with rendering text

Hi,

I have problem with attached document. I add text using getShape().getText().getValue().add(new Txt(“Text”));, for different text styles I add new Cp. When I open attached document I don’t see text in shapes with nubers, for example in shape with number 50 in it, but when I open file as XML I see text which missing. Can You please help me and tell we why is this happening, what is wrong with document?

Thanks
Best regards

Hi Djordje,


Thank you for contacting support. Is it the output VDX file? If so, then please attach your source Visio diagram and complete source code. We’ll take a closer look and reply you accordingly. Please also check this help topic: Apply Different Style on the Each Text Value of a Shape

Hi Imran,

I can not send You my code, because I would must send You my aplication code and I can not do that. I try to reproduct this bug using only aspose code (like I do in most posts) but I can not make same situation because logic of my application is pretty big.
Can You please just look this attached document in some XML editor and tell me do You maybe see what is problem with not showing text from some shapes even that text exist in XML. I am new in visio so I hope You have more experience and can find my problem.

Thanks a lot

Hi Djordje,


Thank you for the inquiry. We don’t require your application project. It looks as shape text items are messed up with each other. We just require your source file and sample code related to the Aspose part. It is must for us to reproduce any issue before fixing it. The input and output diagrams and sample code will give us a clear picture. We use documents for experimental / testing purposes only.

Hi,

I manage to make test which simulates situation which I have in my application and reproduce issue.
Here is my test:
public void test() throws Exception {
String path = “org/gs4tr/filters3/msoffice/visio/Image10.vdx”; //$NON-NLS-1$
InputStream testStream = loadTestResource(path);
Diagram diagram = new Diagram(testStream);
// License licDiagram = new License();
// licDiagram.setLicense(“C:\Aspose.Total.Java.lic”);
// Diagram diagram = new Diagram(
// “/home/emisia/Desktop/visioShape.vdx”);

for (Page page : (Iterable) diagram.getPages())
for (com.aspose.diagram.Shape shape : (Iterable) page
.getShapes()) {
if (shape.getChars().getCount()!=0) {
Char ch = shape.getChars().get(0);
Char ch1 = new Char();
ch1 = createChar(ch);
shape.getChars().clear();
shape.getText().getValue().clear();
GetShapeText(shape, ch1);
}
}
diagram.save("/Image3.vdx", SaveFileFormat.VDX);
}

void GetShapeText(Shape shape, Char ch) {
shape.getChars().add(ch);
shape.getText().getValue().add(new Cp(0));
shape.getText().getValue().add(new Txt(“Text1”));
Char ch1 = createChar(ch);
ch1.setIX(1);
Char ch2 = createChar(ch);
shape.getChars().add(ch1);
ch2.setIX(2);
shape.getChars().add(ch2);
shape.getText().getValue().add(new Cp(1));
shape.getText().getValue().add(new Txt(" "));
shape.getText().getValue().add(new Cp(2));

shape.getText().getValue().add(new Txt(“Text2”));
}

private Char createChar(Char ch) {
Char ch1 = new Char();
ch1.setAsianFont(ch.getAsianFont());
ch1.setCase(ch.getCase());
ch1.setColor(ch.getColor());
ch1.setColorTrans(ch.getColorTrans());
ch1.setComplexScriptFont(ch.getComplexScriptFont());
ch1.setComplexScriptSize(ch.getComplexScriptSize());
ch1.setDblUnderline(ch.getDblUnderline());
ch1.setDel(ch.getDel());
ch1.setDoubleStrikethrough(ch.getDoubleStrikethrough());
ch1.setFont(ch.getFont());
ch1.setFontScale(ch.getFontScale());
ch1.setHighlight(ch.getHighlight());
ch1.setLangID(ch.getLangID());
ch1.setLetterspace(ch.getLetterspace());
ch1.setLocale(ch.getLocale());
ch1.setLocalizeFont(ch.getLocalizeFont());
ch1.setOverline(ch.getOverline());
ch1.setPerpendicular(ch.getPerpendicular());
ch1.setPos(ch.getPos());
ch1.setRTLText(ch.getRTLText());
ch1.setSize(ch.getSize());
ch1.setStrikethru(ch.getStrikethru());
ch1.setStyle(ch.getStyle());
ch1.setUseVertical(ch.getUseVertical());
return ch1;
}

If You try this with Image10.vdx attached document You will see that for some shapes test code works as expected but for some not. I don’t know where is difference. Also I attached new document with one shape in which I reproduced issue. Do You know where is problem?

Thanks
Best regards

Hi Djordje,


Thank you for supplying sample code and source files. We have tested your sample diagrams against the latest build of Aspose.Daigram 5.2.0 and managed to replicate the problem of invisible text items. The shape’s text is not missing, it’s available and not visible due to the setting of character scale at zero. We have logged these issues as follows:

File Name: DrawingTwo.vdx
DIAGRAMJAVA-50166 - Char scale error while manipulating the shape’s text

File Name: Image10.vdx
DIAGRAMJAVA-50167 - Char scale error while manipulating the shape’s text

Your post has also been linked to these issues. We’ll let you know once a significant progress has been made in this regard. We’re sorry for the inconvenience caused.

As a workaround, please add formatting characters as narrated in the help topic below and then set the font, font style and color, etc. We hope, this helps.

Please refer to the following help topic: Apply Different Style on the Each Text Value of a Shape

Hi Djordje,


Thank you for being patient. Please set the font scale value of the text items and discard formula value inside the createCharacter method of your sample code. It’ll properly display shape text items. It works with the latest version of Aspose.Diagram for Java 5.2.0.

[Java]
ch1.setUseVertical(ch.getUseVertical());
ch1.setFontScale(ch.getFontScale());
ch1.getFontScale().getUfe().setF(“”);

return ch1;


We hope, this helps. Please write us back in case of any confusion or questions.

Note: we have closed issue ids DIAGRAMJAVA-50166 and DIAGRAMJAVA-50167

Hi,


for .vdx and .vsd files I use aspose.Diagram not aspose.BarCode. Is this fixed in aspose.Diagram?
I am confused a little bit with your answer. Can You explain me what is happening?

Thanks
Best regards

Hi Djordje,


Thank you for asking about it. We’re sorry for the confusion caused. Our product team has suggested to modify the sample code to properly display the shape text items. So please alter your sample code as narrated in our earlier post and use the latest version of Aspose.Diagram for Java 5.2.0. We have closed these issues as “Won’t Fix”.

We hope, this clears the situation. If you have any confusion or questions, then please reply us.

Hi,

can You please check this issue once again, I used aspose.diagram 5.2.0 with same .vdx file and test changed as You recommended me and I again reproduced issue.

public void test() throws Exception {

String path = “org/gs4tr/filters3/msoffice/visio/Image10.vdx”; //$NON-NLS-1$

InputStream testStream = loadTestResource(path);

Diagram diagram = new Diagram(testStream);

// License licDiagram = new License();

// licDiagram.setLicense(“C:\Aspose.Total.Java.lic”);

// Diagram diagram = new Diagram(

// “/home/emisia/Desktop/visioShape.vdx”);

for (Page page : (Iterable) diagram.getPages())

for (com.aspose.diagram.Shape shape : (Iterable) page

.getShapes()) {

if (shape.getChars().getCount()!=0) {

Char ch = shape.getChars().get(0);

Char ch1 = new Char();

ch1 = createChar(ch);

shape.getChars().clear();

shape.getText().getValue().clear();

GetShapeText(shape, ch1);

}

}

diagram.save("/Image3-5.2.vdx", SaveFileFormat.VDX);

}

void GetShapeText(Shape shape, Char ch) {

shape.getChars().add(ch);

shape.getText().getValue().add(new Cp(0));

shape.getText().getValue().add(new Txt(“Text1”));

Char ch1 = createChar(ch);

ch1.setIX(1);

Char ch2 = createChar(ch);

shape.getChars().add(ch1);

ch2.setIX(2);

shape.getChars().add(ch2);

shape.getText().getValue().add(new Cp(1));

shape.getText().getValue().add(new Txt(" “));

shape.getText().getValue().add(new Cp(2));

shape.getText().getValue().add(new Txt(“Text2”));

}

private Char createChar(Char ch) {

Char ch1 = new Char();

ch1.setAsianFont(ch.getAsianFont());

ch1.setCase(ch.getCase());

ch1.setColor(ch.getColor());

ch1.setColorTrans(ch.getColorTrans());

ch1.setComplexScriptFont(ch.getComplexScriptFont());

ch1.setComplexScriptSize(ch.getComplexScriptSize());

ch1.setDblUnderline(ch.getDblUnderline());

ch1.setDel(ch.getDel());

ch1.setDoubleStrikethrough(ch.getDoubleStrikethrough());

ch1.setFont(ch.getFont());

[//ch1.setFontScale](https://ch1.setfontscale/)(ch.getFontScale());

ch1.setHighlight(ch.getHighlight());

ch1.setLangID(ch.getLangID());

ch1.setLetterspace(ch.getLetterspace());

ch1.setLocale(ch.getLocale());

ch1.setLocalizeFont(ch.getLocalizeFont());

ch1.setOverline(ch.getOverline());

ch1.setPerpendicular(ch.getPerpendicular());

ch1.setPos(ch.getPos());

ch1.setRTLText(ch.getRTLText());

ch1.setSize(ch.getSize());

ch1.setStrikethru(ch.getStrikethru());

ch1.setStyle(ch.getStyle());

ch1.setUseVertical(ch.getUseVertical());

ch1.setFontScale(ch.getFontScale());

ch1.getFontScale().getUfe().setF(”");

return ch1;

}

I attached saved file.

Just one more thing, before I got notifications on my email when You answer me, but for last to months I don’t get it and I would like to get it in future if is possible.

Thanks

Best regards

Hi Djordje,


Thank you for the feedback. Please note, we could not notice any hidden text of the shapes in the output VDX file. If you think it’s still missing some text, then please highlight it through the screenshot. It’ll help us to be more specific.
djordje:
Just one more thing, before I got notifications on my email when You answer me, but for last to months I don’t get it and I would like to get it in future if is possible.
Please check your email settings under the Aspose site account (email tab) and make sure that the receive email options are marked as “Yes”. Please confirm and let us know. If even then it does not work, we’ll ask our web team to look into the matter and fix it.

Hi Imran,


in every pink and yellow shape of this document text:“Text2” is missing, I see only “Text1”, if You see “Text1” and “Text2” in every shape can You tell me which Visio version do You use?

Can You send me Your screen-shoot?

I attached screen shoot of what I see when open previously attached document.

Thanks
Best regards

Hi Djordje,


Thank you for the details. As you narrated earlier (in this post) that you have attached the output VDX file. When we opened it on our side, we could notice the both text items (“Text1” & “Text2”) in the each pink shape. It’s not the case with Yellow shapes. Please attach your source Visio diagram. We’ll investigate and reply you accordingly. The source diagrams against the ticket ids DIAGRAMJAVA-50166 and DIAGRAMJAVA-50167 appear different.

It also looks as we are using a different Microsoft Office Visio version to open it. Please provide us your Microsoft Office Visio version and edition details. We have attached a screenshot for your reference (Screenshot.png).

We’re looking forward to help you.

Hi Imran,


I attached source document. I use Microsoft Visio Premium 2010, which version do You use?

I think “Text2” should appear in every shape (in Yellow too), if You open target file as XML You can see that there is “Text1” and “Text2” in every shape.

Thanks
Best regards

Hi Djordje,

Thank you for the inquiry. Please also set the size and font properties and also discard their formula values inside the createCharacter method of your sample code. After these modifications, we could notice the both text items (“Text1” & “Text2”) in the each shape of the diagram.

[Java]

ch1.setUseVertical(ch.getUseVertical());
ch1.setFontScale(ch.getFontScale());
ch1.getFontScale().getUfe().setF("");
ch1.setSize(ch.getSize());
ch1.getSize().getUfe().setF("");
ch1.setFont(ch.getFont());
ch1.getFont().getUfe().setF("");
return ch1;

djordje:
I use Microsoft Visio Premium 2010, which version do You use?

We have checked against the listed builds below and the output Visio diagram looks perfect to us:

Microsoft Visio Professional 2010
Version: 14.0.7015.1000

Microsoft Visio Professional 2013
Version: 15.0.4569.1506

Microsoft Visio Viewer 2010
Version: 14.0.4763.1000

We have attached our output Visio file for your reference. Please open it in your environment and see how it goes on your side.

We’re looking forward to help you.

Hi,


when I open attached file it looks good, I found where is difference, I can not execute this code: ch1.setSize(ch.getSize());
ch1.getSize().getUfe().setF("");
ch1.setFont(ch.getFont());
ch1.getFont().getUfe().setF("");
in this order, because of logic in mu application. When I execute this test, which can simulate how it works in my application I again can not see all text. Here is test:

// this test is only for fast testing of aspose
public void test() throws Exception {
String path = “Image10.vdx”; //$NON-NLS-1$
InputStream testStream = loadTestResource(path);
Diagram diagram = new Diagram(testStream);
// License licDiagram = new License();
// licDiagram.setLicense(“C:\Aspose.Total.Java.lic”);
// Diagram diagram = new Diagram(
// “/home/emisia/Desktop/visioShape.vdx”);

for (Page page : (Iterable) diagram.getPages())
for (com.aspose.diagram.Shape shape : (Iterable) page
.getShapes()) {
if (shape.getChars().getCount() != 0) {
Char ch = shape.getChars().get(0);
Char ch1 = new Char();
ch1 = createChar(ch);
shape.getChars().clear();
shape.getText().getValue().clear();
GetShapeText(shape, ch1);
}
}
diagram.save("/AposeReorder.vdx",
SaveFileFormat.VDX);
}

void GetShapeText(Shape shape, Char ch) {
shape.getChars().add(ch);
shape.getText().getValue().add(new Cp(0));
shape.getText().getValue().add(new Txt(“Text1”));
Char ch1 = createChar(ch);
ch1.setIX(1);
Char ch2 = createChar(ch);
shape.getChars().add(ch1);
ch2.setIX(2);
shape.getChars().add(ch2);
shape.getText().getValue().add(new Cp(1));
shape.getText().getValue().add(new Txt(" “));
shape.getText().getValue().add(new Cp(2));

shape.getText().getValue().add(new Txt(“Text2”));

}

private Char createChar(Char ch) {
Char ch1 = new Char();
ch1.setAsianFont(ch.getAsianFont());
ch1.setCase(ch.getCase());
ch1.setColor(ch.getColor());
ch1.setColorTrans(ch.getColorTrans());
ch1.setComplexScriptFont(ch.getComplexScriptFont());
ch1.setComplexScriptSize(ch.getComplexScriptSize());
ch1.setDblUnderline(ch.getDblUnderline());
ch1.setDel(ch.getDel());
ch1.setDoubleStrikethrough(ch.getDoubleStrikethrough());
ch1.setFont(ch.getFont());
ch1.setFontScale(ch.getFontScale());
ch1.setHighlight(ch.getHighlight());
ch1.setLangID(ch.getLangID());
ch1.setLetterspace(ch.getLetterspace());
ch1.setLocale(ch.getLocale());
ch1.setLocalizeFont(ch.getLocalizeFont());
ch1.setOverline(ch.getOverline());
ch1.setPerpendicular(ch.getPerpendicular());
ch1.setPos(ch.getPos());
ch1.setRTLText(ch.getRTLText());
ch1.setSize(ch.getSize());
ch1.setStrikethru(ch.getStrikethru());
ch1.setStyle(ch.getStyle());
ch1.setUseVertical(ch.getUseVertical());
ch1.getSize().getUfe().setF(”");
ch1.getFont().getUfe().setF("");

return ch1;
}

Source document is same like in previous post.
Can You help me with this?

Thanks
Best regards

Hi Djordje,


Thank you for contacting support. You could execute these lines in any order. In your sample code, you have simply missed to discard the font scale formula value. We just added this line and it works as expected.

[Java]
ch1.getSize().getUfe().setF("");
ch1.getFont().getUfe().setF("");
ch1.getFontScale().getUfe().setF("");
return ch1;

We have attached the output VDX file for your reference. Please let us know in case of any confusion or questions. We'll be glad to assist you.