t1 = TopicElement() # create a new element t1.setTopicHyperlink(s1.getID( )) # set a link from this topic to the first sheet given by s1.getID() t1.setTitle("redirection to the first sheet") # set its title t2 = TopicElement() t2.setTitle("second node") t2.setURLHyperlink("https://xmind.net") # set an hyperlink t3 = TopicElement() t3.setTitle("third node") t3.setPlainNotes("notes for this topic") # set notes (F4 in XMind) t3.setTitle("topic with \n notes") t4 = TopicElement() t4.setFileHyperlink("logo.jpeg") # set a file hyperlink t4.setTitle("topic with a file") # then the topics must be added to the root element r2.addSubTopic(t1) r2.addSubTopic(t2) r2.addSubTopic(t3) r2.addSubTopic(t4) topics = r2.getSubTopics() # to loop on the subTopics for topic in topics: topic.addMarker("yes") w.addSheet(s2) # the second sheet is now added to the workbook rel = s2.createRelationship(t1.getID(), t2.getID(),
t1=TopicElement() # create a new element t1.setTopicHyperlink(s1.getID()) # set a link from this topic to the first sheet given by s1.getID() t1.setTitle("redirection to the first sheet") # set its title t2=TopicElement() t2.setTitle("second node") t2.setURLHyperlink("https://xmind.net") # set an hyperlink t3=TopicElement() t3.setTitle("third node") t3.setPlainNotes("notes for this topic") # set notes (F4 in XMind) t3.setTitle("topic with \n notes") t4=TopicElement() t4.setFileHyperlink("logo.jpeg") # set a file hyperlink t4.setTitle("topic with a file") # then the topics must be added to the root element r2.addSubTopic(t1) r2.addSubTopic(t2) r2.addSubTopic(t3) r2.addSubTopic(t4) topics=r2.getSubTopics() # to loop on the subTopics for topic in topics: topic.addMarker("yes") w.addSheet(s2) # the second sheet is now added to the workbook
def gen_sheet2(workbook, sheet1): # ***** second sheet ***** # create a new sheet and add to the workbook by default sheet2 = workbook.createSheet() sheet2.setTitle("second sheet") # a sheet has a blank sheet by default root_topic2 = sheet2.getRootTopic() root_topic2.setTitle("root node") # use other methods to create some sub topic element topic1 = TopicElement(ownerWorkbook=workbook) # set a topic hyperlink from this topic to the first sheet given by s1.getID() topic1.setTopicHyperlink(sheet1.getID()) topic1.setTitle("redirection to the first sheet") # set its title topic2 = TopicElement(ownerWorkbook=workbook) topic2.setTitle("topic with an url hyperlink") topic2.setURLHyperlink( "https://github.com/zhuifengshen/xmind") # set an url hyperlink topic3 = TopicElement(ownerWorkbook=workbook) topic3.setTitle("third node") topic3.setPlainNotes("notes for this topic") # set notes (F4 in XMind) topic3.setTitle("topic with \n notes") topic4 = TopicElement(ownerWorkbook=workbook) topic4.setFileHyperlink("logo.png") # set a file hyperlink topic4.setTitle("topic with a file") topic1_1 = TopicElement(ownerWorkbook=workbook) topic1_1.setTitle("sub topic") topic1_1.addLabel("a label") # official XMind only can a one label topic1_1_1 = TopicElement(ownerWorkbook=workbook) topic1_1_1.setTitle("topic can add multiple markers") topic1_1_1.addMarker(MarkerId.starBlue) topic1_1_1.addMarker(MarkerId.flagGreen) topic2_1 = TopicElement(ownerWorkbook=workbook) topic2_1.setTitle("topic can add multiple comments") topic2_1.addComment("I'm a comment!") topic2_1.addComment(content="Hello comment!", author='devin') # then the topics must be added to the root element root_topic2.addSubTopic(topic1) root_topic2.addSubTopic(topic2) root_topic2.addSubTopic(topic3) root_topic2.addSubTopic(topic4) topic1.addSubTopic(topic1_1) topic2.addSubTopic(topic2_1) topic1_1.addSubTopic(topic1_1_1) # to loop on the subTopics topics = root_topic2.getSubTopics() for index, topic in enumerate(topics): topic.addMarker("priority-" + str(index + 1)) # create a relationship sheet2.createRelationship(topic1.getID(), topic2.getID(), "relationship test")