07-04-2012 07:30 AM
i am using Report generation toolkit and i made a template of 2 page, first page i made for test 1 and second page i made for test 2,
for some testing want to generate the report test1 and test 2.
for some testing want to generation the report test 1 only, that time i want to delete the second page.
how to do this?
attached template.
07-05-2012 12:36 PM
It would be a lot easyer if you use Excel, you could then delete a sheet. Since there is no Page object in Word it is a lot more difficult. A possibility (there is probably a better way to do it) would be to insert a section break (next page) to separate you pages instead of pressing the enter key repeatably (which is a bad habit). You can then call the _Document-> Sections collection to get a reference to section index 2 (your second page). Get the Range property of this section and then apply the Delete method.
You now have to remove the section break. Get a reference to the first section (index 1). Get the Range property of this Section and get the Find property of this range and then apply the Find method with ^b to the FindText input (^b is a section break) and an empty string constant to the ReplaveWith input. Et voilà.
Ben64
08-17-2017 12:12 PM