We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Italic To HTML in aspose

Hi Tahir,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Here is the code to convert the italic to html in interop,

private void italicToHTML(Document doc)

{

AppLog.trace("italicToHTML");

object replaceAll = WdReplace.wdReplaceAll;

object findText = "";

object replaceText = "^&";

Find wf = doc.Content.Find;

wf.ClearFormatting();

wf.Font.Italic = 1;

wf.Replacement.ClearFormatting();

wf.Replacement.Font.Bold = 0;

wf.Text = "*";

wf.Execute(ref findText, ref noData, ref noData, ref noData, ref noData, ref noData, ref noData, ref noData, ref vTrue, ref replaceText, ref replaceAll, ref noData, ref noData, ref noData, ref noData);

}

PF the attached documet that is being used for the above functionality and the o/p i am getting is :

You can measure the amount of time that a driver spends in deferred procedure calls (DPCs) and interrupt service. routines (ISRs) by tracing these events in the Windows kernel. This information will help you to minimize the time the driver spends at higher IRQLs, making the driver and the system more efficient.

Starting Date: Ending Date:

Years start: End:

Could you please provide me the ASPOSE code to get the same result.

please assist.

Can you please assist ?

Hi Komal,


Thanks for your inquiry and sorry for the delayed response. You can achieve this by using the following code snippet:

// Load document into Aspose.Words’ DOM

Document doc = new Document(@"C:\Temp\SampleDoc.docx");

// Join Runs with same formatting

doc.JoinRunsWithSameFormatting();

// Create an instance of DocumentBuilder class

DocumentBuilder builder = new DocumentBuilder();

// Get a collection of all Run nodes in document

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

foreach (Run run in runs){

// Get text of Run

string text = run.ToString(SaveFormat.Text);

// Insert Run's text into a TXT file if it is not empty and formatted as italic

if (run.Font.Italic && !text.Trim().Equals(string.Empty))

builder.Writeln("" + text + "");

}

// Save the TXT file

builder.Document.Save(@"C:\Temp\out.txt");


I hope, this helps.

Best regards,