Hello,
We currently have a process that utilizes the word interop assemblies to load and convert word documents to SGML. Part of the process is building up dictionaries of objects that store start and end positions of various things (like all underlined words within a range, all bolded words within a range, among other things). We would like to utilize Aspose.Words for this process for better performance as well as removing the need to have MS Word installed. Is there a way in Aspose.Words to get the starting and ending character positions of a Range (or node)?
Thanks for your interest in Aspose.Words. Yes, you can easily meet this requirement. Please see the following code:
Document doc = new Document(MyDir + @"in.docx");
doc.JoinRunsWithSameFormatting();
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
string text = run.ToString(SaveFormat.Text);
Console.WriteLine("Start character of this Run: " + text[0]);
Console.WriteLine("End character of this Run: " + text[text.Length - 1]);
}
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.