Free Support Forum - aspose.com

Question on Parsing strings for displaying text

I have downloaded the trial and was trying to look for examples that would let me identify certain tags like in a string of text and be able to interpret them as bold font.

Currently I have a small web page that uses FreeText boxt to write text to a sql database and I want to be able to save the data and later pull it back out and create a word document on the fly.

Is the software capable if identifying tags in a string and converting them ? If so is there a link to the examples ?

Thanks,

Hi,

Thank you for evaluating Aspose.Word.

Since Aspose.Word internal model is format independent, you can directly determine various text formatting, not certain HTML tags. Here is a code sample that extracts runs of text that have bold font formatting:

Document doc = new Document(“input.html”);

NodeCollection nodes = doc.GetChildNodes(NodeType.Run, true);

foreach (Run run in nodes)
{
if (run.Font.Bold)
{
// Do smth with the string
}
}

I am not sure in details of the way you want to save text to the database, but you can either use DocumentBuilder to compose a document on the fly or say save them in HTML format and then just import them to convert to .doc (note the above example imports a HTML file as well).

Feel free to post further questions regarding the product capabilities.