Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create multiple pages simultaneously

Mick Davidson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2015

Hello,

I don't think this is possible within Confluence as it stands, but is there a way of doing this programatically?

I think there's two ways this could be done:

  1. Simple method: create x number of new pages under the same parent (possibly from a template). Once created, you have to manually add the page title (presumably replacing an temporary page name). 
  2. Complex method: create x number of new pages under the same parent and give them all the correct names automagically. 

I'm not concerned about making them from a template, but being able to do this both from a template AND independently of a template would be good.

But I'm no programmer, so I may be talking out the back of my head. smile

We're using 5.7.3, Server.

Cheers and TIA.

8 answers

11 votes
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2015

Create a Word file, enter the page names as headlines and import the file into Confluence with "Import Word Document" and the option "Split by heading".

Confluence will automatically create a new page for every headline and structure it according to the chosen headline levels.

 

 

Mayur Mittal July 30, 2018

Awesome!!

Patrick O_Connell November 8, 2018

Steffen,

 

There's one thing to note, here: Confluence will not process multiple levels of headings from the Word document, then create a whole tree structure of new pages.

It's a one-heading-level process, and at least so far, the choices are only Heading 1 or Heading 2.

 

Cheers,
Pat O'Connell
Technical Writer
Montreal

Like Anton Prykhodko likes this
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2018

Don't know if I understand, but if I load a word file with heading levels h1-h6, it offers "Split by heading: Level 1-6" and creates a tree structure with all the levels.

Patrick O_Connell March 8, 2019

Well. I wanted to try this again. Trying to avoid a lot of creating a page tree structure manually. I created a short test Word doc with four levels of headings.

It turns out that I didn't understand Confluence offering to split things based on headings 1, 2, 3 or 4! Here's the actual poop:

"Level 1 Headings" - Splits only based on Level 1
"Level 2 Headings" - Splits on Levels 1 and 2
"Level 3 Headings" - Splits on Levels 1, 2 and 3
etc.

And there's a little preview ("Document Outline") below the drop-down where you pick how to split. I haven't followed through with this, but with my test document, here's the text of the preview. I've redacted it a bit because we're in a highly competitive industry:

  • P****** Platform
    • ** – Emergency Cheat Sheet
      • Black Friday – Emergency Protocol
      • Holidays – Emergency Protocol
      • Valentine’s Day – Emergency Protocol
    • C***** Groups
    • ** Live Support
    • Documentation
      • Cross-Team (Collaborative) Documentation
        • B***end
        • F***tend

So as it turns out, I unfairly maligned Atlassian, back in November.

 

Best,
Pat O'Connell
Technical Writer
MindGeek Montreal

Like # people like this
Tomas Junger October 10, 2019

This is excellent automation for multiple import pages. It works correctly! Thank you very much! 

3 votes
Olivia Hydari June 12, 2018

How to create multiple pages in confluence using a word doc with heading titles.

 

Step 1 - create a word doc and write out all the names of your pages in a list.

Step 2 - select the text and give a title 1 heading and save

Step 3 - create a blank confluence page and give it any name

Step 4 - click on the three dots in the top right corner 

Step 5 - Select "import word document"

Step 6 - Click "select file" and locate your file

Step 7 - Press "import"

Step 8 - A screen comes up called "Import Word Document: Configuration" - on this page, go to the bottom where it says "split by heading" and change it to "level 1 headings" and press import

Step 9 - its done, the pages are created, now you need to move them around.Screen Shot 2018-06-12 at 1.15.23 PM.pngScreen Shot 2018-06-12 at 1.15.48 PM.png

Patrick O_Connell November 8, 2018

Olivia, thank you for your answer to this.

We're on 6.9.x - I think non-cloud version.

I found only one caveat. I had already created the parent page for the sub-pages that I wanted to create in this way, so it actually created a new parent.

Then I had to reorder pages and delete the extraneous one, but meh! Not the end of the world.

 

Pat O'Connell
Technical Writer
Montreal

Patrick O_Connell November 15, 2018

There's a second caveat to this, I have found.

I decided I would do a large number of headings in a Word doc, as I had quite a page tree structure to create. Bring 'em all in, then reorder. I had been doing this a chunk at a time, importing and then reordering non-alphabetically. (Confluence, do you think maybe there's a reason I'm bringing these things in in a specific order?)

I should mention at this point that all of these headings, all of them, had a colon ( : ) in them.

So, put them into Word. Did the import. Every single colon was turned into an underscore. No global search-and-replace sans a plugin, and my employer's averse, not just because of cost.

So, at least some of the time I saved not doing things in chunks was spent manually editing the title of each of those pages.

 calvin_one_weird_face.png<------ me

 

Pat O'Connell
Technical Writer
Montreal

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2018

No solution, but I can confirm that you are right with all you said:

  • When importing and splitting a word file, the new pages are reordered by Confluence (I think alphabetically) and you have to reorder them.
  • As regards page names, Confluence has some limitation as to what symbols are allowed. Didn't know that in this case the colon is automatically replaced, though.
  • No global search and replace, true!

Using the Word import function to create pages simultaneously is not more than a workaround.

Deleted user February 26, 2019

I confirm it worked (for me):

  1. I imported a Word document with 3 levels of headings.
  2. I imported this Word Document + split option + selected "level 2" splitting (out of 3 maximum).
  3. Confluence created as many pages as I had of level 1 and 2 titles.
  4. The order of the pages was respected.
  5. Level 3 titles were converted into "Heading 1" titles inside each Confluence page.
  6. All the tables and pictures were also imported correctly.

Perfect.

Like write2reuben likes this
Arne Marschall January 21, 2021

Didn't work for me today.

I have prepared a word file using one Heading 1 line and several Heading 2 lines below.

I have saved it to a file in DOCX format but I used Libre Office Writer.

I have imported and chosen to break on Level 2 headings.

But the result was one single page.

 

Now I am going ahead to hack my 30+ pages manually in :(

Giulio Bonanome February 9, 2021

I don't have Microsoft Office on my computer. Even I had tried both Mac Pages and LibreOffice with no luck :( :( So the document was imported without splitting the headings. I think is a problem on how Pages and LibreOffice deal with the outline of the document.

BTW then I tried Google Doc and it works!! The .docx generated by Google Doc is imported correctly by Confluence, with heading split working.

🥳🥳🥳🥳

0 votes
Fabio November 12, 2020

Nice :)

0 votes
BAPrice May 11, 2020

The Problem:  No easy way to bulk import documents into Confluence AND importing one document at a time is tedious.

 

Proof of Concept:

The code I used is in 3 chunks to achieve the goals numbered below. (You run 3 macros, in sequence.) (I’m no programmer, it’s messy.):

  1. Demote all headings (down 1) within the documents.
  2. Add a new Heading 1 (with file name as the text) to each document
  3. Merge all documents into 1 document that can be imported into Confluence via the regular process (splitting at Heading 1—or lower, for multi-level documents).

 

PART ONE: Demote All Headings

Sub DoVBRoutineNow()

'This allows you to loop through all the documents in the path specified below.

'It calls DemoteAllHeadings to demote all the headings.

Dim file

Dim path As String

 

path = "C:\temp\"

 

'This next line mentions DOC but it still picked up DOCX... cool

file = Dir(path & "*.doc")

Do While file <> ""

Documents.Open FileName:=path & file

 

‘This is the SUB provided below

Call DemoteAllHeadings

 

ActiveDocument.Save

ActiveDocument.Close

 

file = Dir()

Loop

End Sub

 

Sub DemoteAllHeadings()

'This VBA actually demotes the headings

'Use this with DoVBRoutineNow to demote headings of all documents in a folder.

    Dim p As Paragraph

    Dim sParStyle As String

    Dim iHeadLevel As Integer

 

    For Each p In ActiveDocument.Paragraphs

        sParStyle = p.Style

        If Left(sParStyle, 7) = "Heading" Then

            iHeadLevel = Val(Mid(sParStyle, 8)) + 1

            If iHeadLevel > 9 Then iHeadLevel = 9

            p.Style = "Heading " & iHeadLevel

        End If

    Next p

End Sub

 

PART TWO: Add Filename as Heading 1 to Each Document

NOTE: Heading 1 is in ALL CAPS. Maybe we could fix that in a second iteration of this code/process.

 

Sub DoVBRoutineNow2()

'Again: This allows you to loop through all the documents in the path specified below.

'It calls EnterFilename to enter the filename as a heading.

Dim file

Dim path As String

 

path = "C:\temp\"

 

file = Dir(path & "*.doc")

Do While file <> ""

Documents.Open FileName:=path & file

 

Call InsertFileNameOnly

 

ActiveDocument.Save

ActiveDocument.Close

 

file = Dir()

Loop

End Sub

 

Sub InsertFileNameOnly()

    Dim xPathName As String

    Dim xDotPos As Integer

    With Application.ActiveDocument

        If Len(.path) = 0 Then .Save

        xDotPos = VBA.InStrRev(.Name, ".")

        xPathName = VBA.Left(.Name, xDotPos - 1)

    End With

    Application.Selection.Style = ActiveDocument.Styles("Heading 1")

    Application.Selection.TypeText xPathName

    'Selection.TypeParagraph

End Sub

 

PART THREE: Merge the Documents

I made sure to have a blank document open to begin this process.

 

Sub MergeMultiDocsIntoOne()

Dim dlgFile As FileDialog

Dim nTotalFiles As Integer

Dim nEachSelectedFile As Integer

 

Set dlgFile = Application.FileDialog(msoFileDialogFilePicker)


With dlgFile

.AllowMultiSelect = True

If .Show <> -1 Then

Exit Sub

Else

nTotalFiles = .SelectedItems.Count

End If

End With


For nEachSelectedFile = 1 To nTotalFiles

Selection.InsertFile dlgFile.SelectedItems.Item(nEachSelectedFile)

If nEachSelectedFile < nTotalFiles Then

Selection.InsertBreak Type:=wdPageBreak

Else

If nEachSelectedFile = nTotalFiles Then

Exit Sub

End If

End If

Next nEachSelectedFile

End Sub

0 votes
Parthiban May 14, 2018

Hi Mick,

Did you achieved this ?

Regards,

Parthiban

Olivia Hydari June 12, 2018

Yes it works. I will write an answer with screenshots.

0 votes
EPS Software Engineering AG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2016

Hi,

For those who do not want to get into the Java programming. Try our Page Tree Creator Add-on.

Our Add-on Page Tree Creator works a bit different than the Confluence blueprints / templates. The PTC-templates are based on normal confluence pages and therefore creating a PTC-template is as simple as creating a Confluence page. Of course you could start creating your PTC-blueprint based on an existing Confluence page.

Try our Live Examples (no registration needed).

Marketplace link: Page Tree Creator.

Regards,
Stephan

0 votes
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2015

If the template part is important to you, you can include that into that Word file as well (at least to some extent).

If all the pages must have the same layout with e.g. headline followed by paragraph followed by an image you can add that to the Word file and it will become the content of your wiki page.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 26, 2015

Confluence Command Line Interface (CLI) has support for doing this type of automation. For instance, How to create pages from template pages.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events