none
how to get the name of cover page? RRS feed

  • Question

  • I have to make a .net application(in C#) which read a word file ad find the cover page name. https://1drv.ms/w/s!Ah-Jh2Ok5SuHbZxlkEaWihO1geU here i put a sample file. I added a cover page (Named as Austin) to the file. I want the name("Austin") of the cover page. search in the google but didnt find any help.
    Tuesday, October 18, 2016 8:45 AM

Answers

  • Hi,

    In my opinion, Office doesn’t provide any methods or properties to let us retrieve the used buildingblocks name. You could check BuildingBlock Object (Word) & BuildingBlockEntries Object (Word)

    What I have done:

    1)Insert the coverpage and get the recorded macro:

        Application.Templates( _

            "C:\Users\v-chencl\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Built-In Building Blocks.dotx" _

            ).BuildingBlockEntries("Austin").Insert Where:=Selection.Range, RichText _

            :=True

    2)Check the attached template properties, (Template Object (Word)) it could lists all the BuildingBlockEntries with coverpagetype(wdTypeCoverPage, we could find all types in WdBuildingBlockTypes Enumeration (Word))

    3)Insert the same coverpage in a new document, compare them with Open XML SDK Tool.

    4)Insert a different coverpage (Banded) in a new document, compare them with Open XML SDK Tool.

    The results indicate that there is no string value such as Austin or Banded stored in the document.

    Comparing between two files with same coverpage, different w:val indicates it is randomly generated. 

    Thursday, October 20, 2016 5:42 AM
    Moderator

All replies

  • Hi,

    For your sample file, I could not find the "Austin".

    What does you refer? Could you please tell us how to get/find the "Austin" manually? Or how do you add the cover page and the name?

    Wednesday, October 19, 2016 7:07 AM
    Moderator
  • @Celeste, Thanks. You can add the cover page by following way

    1. On the Insert tab, in the Pages group, click Cover Page.
    2. Click a cover page layout from the gallery of options.
    3. I selected the 1st cover page

     
    Wednesday, October 19, 2016 9:57 AM
  • Hi,

    In my opinion, Office doesn’t provide any methods or properties to let us retrieve the used buildingblocks name. You could check BuildingBlock Object (Word) & BuildingBlockEntries Object (Word)

    What I have done:

    1)Insert the coverpage and get the recorded macro:

        Application.Templates( _

            "C:\Users\v-chencl\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Built-In Building Blocks.dotx" _

            ).BuildingBlockEntries("Austin").Insert Where:=Selection.Range, RichText _

            :=True

    2)Check the attached template properties, (Template Object (Word)) it could lists all the BuildingBlockEntries with coverpagetype(wdTypeCoverPage, we could find all types in WdBuildingBlockTypes Enumeration (Word))

    3)Insert the same coverpage in a new document, compare them with Open XML SDK Tool.

    4)Insert a different coverpage (Banded) in a new document, compare them with Open XML SDK Tool.

    The results indicate that there is no string value such as Austin or Banded stored in the document.

    Comparing between two files with same coverpage, different w:val indicates it is randomly generated. 

    Thursday, October 20, 2016 5:42 AM
    Moderator