Question

I'm working on a library to help create word docs and there are a couple of things that don't seem to be clear (trial and error are usually a good place to start but time is of the essence here).

Firstly i want to insert a cover page, one already built into word...is there anyway of doing this?

Secondly, i have a set style on my word document and it is one of the built in ones...Modern. Is there any way of just assigning this style to the document?

There are lots of samples of assigning styles to headers and sections of the document but nothing saying to pick a style from the built in ones.

I appreciate that at this point it might be easier to have a document that has all this in it already set but i would like to do all of this from scratch.

Était-ce utile?

La solution

I have been doing these things in a VSTO project and it is straightforward since I can access the Word Object Model.

  1. Cover Pages are stored in building blocks, so it is similar to adding any building blocks in Word. Here is an eg using Word Object Model here.

Found here that you cant insert building block using open xml sdk

  1. ApplyQuickStyleSet2 will apply quick style sets for the active document. Not sure in OpenXmlSdk but try this

  2. Eg for applying a style

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top