Selecting first paragraphs of chapters

Everything related to our flagship word processor.
Post Reply
Kadah
Posts: 16
Joined: 2016-02-19 13:26:05

Selecting first paragraphs of chapters

Post by Kadah »

Hi!
I have a book that has an enormous number of chapters and subchapters. I would like to be able to select all the first paragraphs of those chapters and subchapters to change their indention. But is there a way to do it e.g. using a macro, not manually?
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Selecting first paragraphs of chapters

Post by phspaelti »

Hi Kadah,
the short answer to your question is 'yes'. But to do this one will need more information. How can one recognize Chapters, sub-chapters in your document? Are you using styles ("Heading 1", etc.)? A macro thread that discusses this kind of problem can be found here. If you need help with how to implement that for your case, let me know.
philip
Kadah
Posts: 16
Joined: 2016-02-19 13:26:05

Re: Selecting first paragraphs of chapters

Post by Kadah »

Hi! First of all, thank you for your help. I tried looking at the link you provided, but the discussion there seemed to be a bit too technical. I learned how to use macros, but I am not sure yet how to write one, so if you’d be willing to help me further, I’d appreciate that.

All the chapters and sub-chapters have the Heading style applied to them (from Heading 1 to Heading 4). I would like to be able to select all the paragraphs following the paragraphs with Heading 2, 3 and 4 style applied and change their indentation from 0.8 cm to 0 cm. The heading 2, 3 and 4 styles are aligned to left so the first paragraphs following them would look better with no indentation.

Thanks in advance!
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Selecting first paragraphs of chapters

Post by phspaelti »

Hello again. I am attaching a macro that will select the first paragraph after the requested heading paragraphs. This macro will not change the indentation, you can just do that once the paragraphs have been selected. (Alternately you can apply a style to the selected paragraphs and change their indentation that way.) It would be easy enough to add code for this, but that would just limit the usefulness of the macro.

I put some comments in the macro which should help a bit to understand how it works. I can also provide more elaborate explanations, if desired.

Hope that helps.
Attachments
Select First Paragraphs After Headings.nwm
(7.01 KiB) Downloaded 487 times
philip
Kadah
Posts: 16
Joined: 2016-02-19 13:26:05

Re: Selecting first paragraphs of chapters

Post by Kadah »

IT WORKS!!! Thank you so much, doing this by hand was driving me crazy. Thank you! You're great!
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Selecting first paragraphs of chapters

Post by phspaelti »

The original macro was hardwired to work only for Heading 2,3, & 4 . This is an updated version that lets you choose the heading styles at runtime.
Attachments
Select First Paragraphs After Headings.nwm
Updated version
(7.84 KiB) Downloaded 355 times
philip
Post Reply