Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created October 23, 2022 10:22
Show Gist options
  • Save aspose-com-gists/6961d2c30ccbbae86fc8cc4cdf8155cc to your computer and use it in GitHub Desktop.
Save aspose-com-gists/6961d2c30ccbbae86fc8cc4cdf8155cc to your computer and use it in GitHub Desktop.
Create Documents using Python
d = open("new-file.txt", "w")
d.write("Hellow World")
d.close()
import aspose.words as aw
newdoc = aw.Document()
builder = aw.DocumentBuilder(newdoc)
font = builder.font
font.bold = True
font.name = "Arial"
font.size = 16
font.underline = aw.Underline.DASH
paragraphFormat = builder.paragraph_format
paragraphFormat.first_line_indent = 8
paragraphFormat.alignment = aw.ParagraphAlignment.JUSTIFY
paragraphFormat.keep_together = True
builder.writeln("new file content - hellow world.")
newdoc.save("outputfile.docx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment