Create custom word document

I would like to know how I could extract the information from the model as well as the image of the element and send it to word in an organized and personalized way I have no idea how to do it and I have not found any dynamo package that helps me in my goal

Word format (docx and doc) isn’t easy to deal with in Dynamo at the moment. Perhaps there is another route to get what you need.

What is the end goal you are after? Is it for a PDF of cut sheets? Or some other project deliverable?

The objective is to create the descriptive memories of the elements in the project and to be able to have them in editable form as a doc and after that export it in pdf as a deliverable

Hello @ammed.riveros …here is a way to export to word (doc)

I think it would be best to use another format then. HTML, or even Revit would do the trick.

Hello
Admitting that the format is not too complex, here is an simple example with Word Interop
export_As_Word

import sys
import clr
import System

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('System.Drawing')
import System.Drawing
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import Clipboard

clr.AddReference("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as Word

clr.AddReference("System.Runtime.InteropServices")
import System.Runtime.InteropServices

source_filenamePath = IN[0] 

# clear session
word_application = Word.ApplicationClass()
word_application.Quit()
word_application = None
#
word_application = Word.ApplicationClass()
word_application.visible = True
doc_word = word_application.Documents.Open(source_filenamePath)
fecSymb = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsElementType().ToElements()
imgSize = System.Drawing.Size( 100, 100 )
for symb in fecSymb:
	# add Image
	bitm = symb.GetPreviewImage(imgSize) 
	Clipboard.SetDataObject(bitm)
	doc_end1 = doc_word.Content.End -1
	doc_end2 = doc_word.Content.End
	rng = doc_word.Range(doc_end1, doc_end2)
	rng.Paste()
	# add NAme and Description 
	doc_end1 = doc_word.Content.End -1
	doc_end2 = doc_word.Content.End
	rng = doc_word.Range(doc_end1, doc_end2)
	famName = symb.Family.Name
	symbName = Element.Name.GetValue(symb)
	description = symb.get_Parameter(BuiltInParameter.ALL_MODEL_DESCRIPTION).AsString()
	rng.Text += "Family : {}\nType : {}\nDescription : {}\n".format(famName, symbName, description)
	
OUT = 0
5 Likes