PDA

View Full Version : Get the Reference Number above Header



Foncesa
12-23-2013, 03:57 PM
Hello,

I want to have the reference No. (part of it) above the Header which is empty line. This 1077 is required to be on the first line, at times this can be of 3 digits also. How to get this with a macro for each and every page of the document. The document is of about 500 pages and every page has Header and Reference number.



[HEADER START]
SOMETHING HERE ‘O’ SA-FE. TRAINING COMPANY LIMITED
Something Here, Castle Road, off KBD Street, (Westner), XXXXXXX-1234321
[Ccop. No. DESK/WN/STG/(RO)/304343/2012-13] [HEADER END]
Bill No. 1234567 Bill Date: 1/11/2013

10/-/1077, Foncesa Properties Ltd. [REFERENCE LINE]

macropod
12-23-2013, 05:59 PM
Without seeing a document with some representative data, it's hard to know exactly what is required. However, based on what you have posted, it seems you could do this by inserting a manual page break at the start of the document, then using a wildcard Find/Replace like:
Find = (^m)(*Bill Date*^13^13)(*^13)
Replace = \1\3\2
No macros required.

Foncesa
12-23-2013, 09:42 PM
=macropod;302204]Without seeing a document with some representative data, it's hard to know exactly what is required.

Thanks for the response, I have uploaded a dummy file with desired result. Please have a look.
Thanks in advance.

macropod
12-24-2013, 02:03 AM
The document you provided has no page breaks, which would make any solution difficult to implement, as the pagination on one PC with a given active printer could be different on the same PC using a different active printer or on a different PC using a different Windows version and the same active printer.

While it appears easy enough to identify the part of the Reference No. you want, you also need a reliable way of identifying the where the 'header' content starts. For example, does your 'real' document have actual page breaks to separate the pages? Alternatively, since your document depicts the header starting four paragraphs before the paragraph containing the Reference No., do you always have the header starting four paragraphs before the paragraph containing the Reference No.?

Foncesa
12-24-2013, 07:55 AM
For example, does your 'real' document have actual page breaks to separate the pages? Alternatively, since your document depicts the header starting four paragraphs before the paragraph containing the Reference No., do you always have the header starting four paragraphs before the paragraph containing the Reference No.?

Thanks Paul Edstein for instant response. Well you have asked question regarding page break, so answer to it is YES it has perfect page breaks.

Q.2 your document depicts the header starting four paragraphs before the paragraph containing the Reference No.? YES it is constant style.

I feel that now you can help to sort the problem.

Thanks in advance & Merry Christmas to you.

Foncesa

macropod
12-24-2013, 11:12 PM
OK, then, as per my previous response you could do this by first inserting a manual page break at the start of the document then using a wildcard Find/Replace like:
Find = ((^m)(*Bill Date: [0-9]{1,2}/[0-9]{1,2}/[0-9]{4}^13[!^13]@/)([0-9]@)(,[!^13]@^13)
Replace = \1\3\2\3\4
No macros required.

Foncesa
12-25-2013, 04:57 AM
Thanks for reply,

This is what it says: All done. We have 0 replacements. This does not work.
Is it possible i will send the orignal file to you on your email.
Hoping to have a favorable reply

macropod
12-25-2013, 06:45 PM
Did you check the 'use wildcards' option?

Foncesa
12-25-2013, 10:49 PM
Did you check the 'use wildcards' option?

Yes, i am worried if you have tested and why i am not getting the result.
Please suggest.

macropod
12-26-2013, 12:04 AM
Any differences in outcome are probably because there are differences between your actual data and the sample you posted.

Foncesa
12-26-2013, 01:37 AM
Hello,

I have struggled a lot to have the result finally i am uploading the original file without any changes from my side accept i have deleted from page 4 onwards and hope to have a solution to it.

Please do something.

macropod
12-26-2013, 03:22 AM
The wildcard Find/Replace works OK for me, except that for some reason the Find expression I previously gave appears with an extra '(' at the front. It should be:
Find = (^m)(*Bill Date: [0-9]{1,2}/[0-9]{1,2}/[0-9]{4}^13[!^13]@/)([0-9]@)(,[!^13]@^13)
Replace = \1\3\2\3\4

Had you input the original expression as a wildcard Find/Replace, you would have received an 'invalid pattern match' error rather than a '0 replacements' result.