I have got a document where there are headings which are always the same, but their sub categories are always different. The Structure is as follows:
Line 1: Heading 1
Line 2: Sub Heading 1-1
Line 3: Sub Heading 1-2
Line 4: Heading 2
Line 5: Sub Heading 2-1
Line 6: Sub Heading 2-2
Line 7: Sub Heading 2-3
Line 8: Heading 3
So basically the information I want to extract out of this is that Sub Heading 1-1 & Sub Heading 1-2 are related to Heading 1, Sub Heading 2-1 , Sub Heading 2-2 and 2-3, are related to Heading 2 and so on.
So in terms of code is there some way we can go
1. Find the position of the first line in the document that = "Heading 1"
Position:Line 12. Find the position of the first line in the document that = "Heading 2"
Position:Line 43. Line 4 - Line 1 = 3
4. number of lines between Heading 1 and 2 = 3 - 1 = 2
5. Line 1+1 = Line 2 so Line 2 Should be formated like this:
Heading1,Sub Heading1-16. Line 1+2 = Line 3 so Line 3 Should be formated like this:
Heading1,Sub Heading1-27. Stop adding to Line 1 as we discovered in Point 4 that there are only 2 lines we need to allocate to Heading 1.
I know this is annoyingly complex code, so if you don't have time to go through it could I just get a list of which functions I would need to achieve my objective and then I can research them.