Visio File to Text File conversion

Greetings,



Is it possible to generate a text file out of the contents of the Visio file using Aspose SDK? If yes, then can you kindly share a code snippet that I can use?


Regards,

Syed.

Hi,

I was able to pull the text out of the shapes collection of each page. I can see that the Text property of each shape returns a formatted text string. Is it possible only to access the content of the shape without the formatting?

Looking for an urgent reply.

Regards,
Syed.

Hi Syed,

You can use the following code to extract plain text.

FormatTxtCollection collection = shape.Text.Value;
System.Text.StringBuilder plainText = new StringBuilder();
foreach (object text in collection)
{
 if (text is Txt)
 {
  plainText.Append((text as Txt).Value);
 }
}
Console.WriteLine(plainText.ToString());

Please feel free to contact us in case you have further comments or questions.

Best Regards,

Thank you Ijaz. This worked.