Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-04-2014, 01:15 PM
Cosmo Cosmo is offline Changing 1,2,3,15 to 1-3,15 Windows Vista Changing 1,2,3,15 to 1-3,15 Office 2007
Competent Performer
Changing 1,2,3,15 to 1-3,15
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default Changing 1,2,3,15 to 1-3,15

I have a document with a list of endnotes, and the client wants to consolidate the endnote numbers wherever they appear sequentially. My code already converts the endnotes to text (so that they don't get deleted when the numbers are removed), and now I need to consolidate the numbering, but I am not sure the best way to attack this.

To give an example, the following

This text has several endnotes 1,2,5,6,7,12
___________________
1 This is the first endnote
2 This is the second endnote
....etc.


Should result in

This text has several footnotes 1,2,5-7,12



The numbers will be a combination of endnotes and cross-references, but will be converted to text by the time this code runs.

Does anyone have any ideas to help get me started? Should I loop through the entire document one character at a time? Or maybe use a regex to find each pattern of numbers and commas and parse each result as a list and process?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing color aerospace Outlook 0 04-03-2013 05:56 AM
Changing 1,2,3,15 to 1-3,15 total slack not changing when changing duration ketanco Project 1 02-11-2012 07:23 AM
changing gsrikanth Excel Programming 8 02-08-2012 09:09 PM
Changing Word doc to .txt cialili Word 1 08-02-2010 12:38 PM
changing font size without changing leading carolns Word 1 09-14-2009 12:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft