Creating a word web

Create a document in Word for the web

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

With Word for the web running in your web browser, you can:

  • Create documents to add and format text, images, and page layouts.

  • Get to your documents from your computer, tablet, or phone.

  • Share and work with others, wherever they are.

Notes: 

  • This Quick Start is for Word for the web. For the desktop version of Word for Windows, see the Word Quick Start.

  • For Word on a Mac, see the Office for Mac Quick Start Guides and Word for Mac Help.

Create a file

Rename a document

  • Select the title at the top and type a name.

    Your changes are saved automatically in Word for the web.

Name/Rename a file

Note: If you can’t edit the name, you might be in Reading View. Select Edit Document > Edit in Browser.

Need more help?

create a word web

A deeper understanding of words is never a bad thing. In fact, many keep track of difficult words and practice using those words regularly. If you are here to improve your vocabulary, then using the word web is a tried and tested way to do so. You can create a word web using Microsoft Word. Similarly, there are other options that will let you create a great word web. Before we tell you how to create a word web, know about the word web first. 

What is the word web?

Word webs are a set of words set in a web-like structure. It is also a mind map that helps students develop critical thinking skills. It promotes active learning and is highly valuable for improving vocabulary. Children use the word web to learn new words and expand their vocabulary. Similarly, their many instances that you can do using the word web. We will talk more about the use of the word web later.

Word web offers a simple way to break down words and learn their meaning, synonym, and so many other things related to the word. Teachers can use the word web in the classroom to help children learn new words. On top of that, understand the words better and keep them in memories. It helps children start connecting the dots when they see words. As a result, they learn the meaning of words through high-level thinking practices unlocked by the word web. Word web is one of the ways anyone can improve their speech or writing by using proper words that fit the context.

There are two main ways that you can utilize the word web. Firstly, you can use it to help students learn new words and improve their vocabulary. Secondly, you can use it to help children identify words associated with various topics and events. Similarly, there are plenty of other cases where the word web can come in handy. It is not only used in school but also at a corporate level.

create a word web

Using the word web to learn new words

It is true that the main reason people use the word web is to learn new words. Learning new words spreads into improving tons of skills. Especially writing skills because the writers can use appropriate but not repetitive words in their sentences. With the word web, you can learn the following.

  • Type of word – A great way to introduce parts of speech is through the word web. Children can determine what word is a noun, verb, conjunction or adjective, etc. A word web will simplify the whole process of learning parts of speech.
  • Synonyms – You can learn synonyms of words that you can use to improve your writing skills. Moreover, you will also improve your vocabulary. 
  • Antonyms – Antonyms are just as important as synonyms. They are those words that are the opposite of the chosen word.
  • Category of words – With word web, you are able to identify the category of words. For instance, the word T-shirt, skirt, jeans, and cap belong to the Clothing category. 
  • Meaning – A word can have more than one meaning, and the word web can simplify that for you. You can also explain the meanings when you split certain words. For instance, you can split balls into “ball” and “s.” Explain the meaning of balls and why there are “s” in them.
  • Functions – Whether the word is a noun or adjective, it has a function. You can add the function of the word in the word web.
  • Describe the word – describe words with your five senses so that children can know the nature of those words. If it is a noun, you can tell what a particular word sounds, feels, taste, smell, or look like. For verbs, you can describe them using adverbs.

Once you create a word web, you will be able to understand the meaning of the word. In addition, it will be easier for you to figure out what and when to use the words in a sentence. 

How to use Word Web?

Word web promotes the understanding of students by comparing and contrasting words. Moreover, a word web also gives suitable examples of a word that fits accurately in the context. As a result, students can acquire academic and domain-specific words. After that, they use it in tier two, tier three, and phrases. Here are the steps on how to use Word Web.

  1. Choose the principal words from which you want to tell the model of the word.
  2. Show the structure in a visible location in the form of a chart or project.
  3. Read each word loud and clear.
  4. Highlight the word as you read the words for the children.
  5. Project the word web model and instruct the students how to complete the word web.
  6. Assist or give hints to students as they practice with one or two words. After that, ask the students to create a word web by giving them a new word. 

How to create word web using OffiDocs Online Word Document

Online Word Document offers robust features to create a word that supports doc and Docx files. Moreover, you can also open other files directly from Google drive. After that, you can edit and view those files directly from this app. Online Word Document is available for free at OffiDocs. You can create a word web with this app and use its import feature. Here is the step-by-step guide on creating a word web Online Word Document:

  1. The first step is to use Google Docs, where you have to create the word web. Go to Google Docs.
  2. Now go to Insert and click on drawings. After that, choose “New” to create a blank canvas.
  3. Now create a textbox in the middle of the canvas.
  4. Write the main word inside the textbox. Adjust the position and fonts to make the text according to your taste.
  5. Add a shape around the main word and make the shape transparent. Again you can edit the shape, which is completely up to personal preference.
  6. Now use line tools to draw around the shape. Draw some lines all around the shape on the canvas.
  7. Now you have to type the words connected to the other end of the line. Within the edit section, add a separate textbox for each word to complete the word web. 

The word web is now complete on Google Docs, but you want to make it an Online Word Document. In order to do that, you need to use the import feature of this app by OffiDoc.

  1. Open Online Word Document from the OffiDocs platform.
  2. Go to file and then go to “Open from Google Drive.”
  3. Now select the Google Doc where the word web is created. Simply import it into your Online Word Document.
  4. The Word Web will show up on the app. After that, you can view and edit the file directly from Online Word Document.

Conclusion

Word web is an intuitive and effective way of understanding the connections between words. You can create a word web using plenty of programs such as Microsoft Word and Google Docs. There are thousands of resources available on the internet which teach tips and tricks to effectively use Microsoft Word. Such as if you are facing trouble removing the highlighting in Microsoft word, you can take help from credible online resources. Above all, OffiDocs also has Online Word Document where you can create a Word web. There are dozens of word web templates that enhance students’ learning process. However, you need to make sure that the template is suitable for the type of information you want to share. 

Word онлайн — бесплатный сервис корпорации Майкрософт, предоставляющий доступ к созданию и редактированию документов Microsoft Word в режиме онлайн, без установки программы на компьютер. Пользователь может бесплатно использовать Ворд онлайн для работы с текстовыми документами из браузера.

Microsoft Office — мощный пакет офисных программ, своего рода стандарт для приложений данного типа. Популярные программы, входящие в состав офисного пакета, широко используются на предприятиях и в личных целях пользователями по всему миру.

Содержание:

  1. Как в Ворд онлайн работать бесплатно
  2. Редактирование документа в Word Online
  3. Ворд онлайн в OneDrive
  4. Доступ к Word онлайн в Outlook.com
  5. Microsoft Word онлайн в Яндекс Диск
  6. Ворд онлайн в Облако Mail.Ru
  7. Выводы статьи

Для работы с текстовыми документами используется текстовый процессор Microsoft Word, входящий в состав пакета офисных приложений. MS Office — платное приложение, устанавливаемое на компьютер, распространяемое в разной комплектации, в зависимости от потребностей покупателя. Имеется онлайн версия Word 365, распространяемая по платной подписке.

Не все пользователи знают, что наряду с платными решениями, Microsoft создала бесплатный сервис Office Online, который доступен пользователям совершенно бесплатно. В состав Office Online входит текстовый редактор Word online, а также другие популярные приложения: Excel online и PowerPoint online. Поэтому пользователь может создать документ Ворд онлайн бесплатно, как бы странно это на первый взгляд не звучало.

Разумеется, если Ворд онлайн бесплатно доступен пользователям, сервис имеет меньше функциональных возможностей для работы с текстовыми файлами, по сравнению с платной версией продукта. Для большинства случаев, вполне подойдет редактирование Ворд онлайн, форматирование, сохранение документа при бесплатном варианте использования. Многие пользователи не заметят каких-либо особых различий по сравнению с платной версией программы.

Если на компьютере пользователя не установлен Майкрософт Офис, пользователь может открыть документ Word в текстовом редакторе WordPad, встроенном в операционную систему Windows.

Как в Ворд онлайн работать бесплатно

Программа Ворд онлайн работает на серверах Microsoft. Для доступа к функциям онлайн сервиса необходимо иметь интернет-соединение на своем компьютере.

Для создания документа Word, пользователь заходит на веб-страницу сервиса Word Online, или получает бесплатный доступ к Word онлайн из веб-интерфейса других сервисов корпорации Microsoft: облачного хранилища OneDrive или электронной почты Outlook.com. Редактор Ворд онлайн интегрирован в российские облачные хранилища Яндекс Диск и Облако Mail.Ru, поэтому пользователи могут создать документ Ворд онлайн непосредственно из веб-интерфейса облачного хранилища.

Использовать Ворд онлайн без регистрации не получится, потому что потребуется вход по учетной записи Майкрософт или по логину Skype. В случае использования сервиса из облачного хранилища, все равно понадобится войти в облачное хранилище, введя учетные данные.

Создайте учетную запись Майкрософт, это совсем нетрудно. Другой вариант: войдите в облачное хранилище для того, чтобы выполнить редактирование Ворд онлайн бесплатно, без ввода данных учетной записи Microsoft. Поступайте так, как вам более удобно.

Сторонние компании имеют бесплатные онлайн сервисы, поддерживающие работу с документами в вордовских форматах «.docx» и «.doc». Их использование мы не рассматриваем в этой статье, потому что сейчас нас интересует оригинальный сервис, а не его аналоги.

Редактирование документа в Word Online

Работа с документами Ворд в режиме онлайн проходит в следующем порядке:

  1. Пользователь открывает браузер, а затем входит непосредственно на сайт Word online, или получает доступ к сервису через электронную почту Outlook.com, или в веб-интерфейсе облачных хранилищ OneDrive, Яндекс.Диск, Облако Mail.Ru.
  2. Происходит создание и редактирование документа Word.
  3. Созданный документ автоматически сохраняется в облачном хранилище. Пользователь может скачать файл в формате «DOCX» на компьютер, или скачать на компьютер копию этого файла в форматах «PDF» или «ODT».

Сейчас я покажу, как это происходит, на примере сервиса Word Online:

  1. Перейдите на страницу Word Online.
  2. Введите данные от учетной записи Майкрософт. Если у вас нет учетной записи, создайте ее, это не займет много времени.
  3. В окне «Word Online» нажмите на «Новый документ».
  4. После этого, откроется страница текстового редактора, на которой можно создать, отредактировать, а затем сохранить документ Ворд.

ворд онлайн

После завершения работы с документом Word, щелкните по меню «Файл».

В выпадающем меню выберите «Сохранить как».

В окне «Сохранить как» предложено несколько вариантов для сохранения документа:

  • Сохранить как — сохранение копии в OneDrive, связанным с вашим аккаунтом.
  • Переименовать — переименование файла.
  • Скачать копию — скачивание копии документа на компьютер.
  • Скачать в формате PDF — скачивание копии документа на компьютер в формате «PDF».
  • Скачать в формате OTD — скачивание копии документа на компьютер в формате «ODT».

сохранить как

Обратите внимание, что здесь нет кнопки «Сохранить», так как документ Word сохраняется автоматически.

Выберите подходящий вариант для сохранения документа.

Ворд онлайн в OneDrive

Облачное хранилище OneDrive интегрировано в операционную систему Windows 10. Пользователи, работающие в Windows 7, Windows 8, Windows 8.1, могут установить приложение OneDrive на свой компьютер.

Для работы с Word онлайн программа не понадобится, мы будем использовать веб-интерфейс браузера.

  1. Войдите на сайт OneDrive в браузере.
  2. В левом верхнем углу нажмите на кнопку «Открытие средств запуска для доступа к приложениям Office 365».
  3. Откроется окно с плитками для запуска приложений Microsoft. Нажмите на плитку «Word».

ворд в onedrive

Среди других приложений, пользователю бесплатно доступны в режиме онлайн популярные офисные программы Excel и PowerPoint из бесплатного пакета Office Online.

Доступ к Word онлайн в Outlook.com

Электронная почта Outlook.com тесно связана с другими приложениями Microsoft. Из электронной почты можно получить доступ к средствам Office online.

  1. Войдите в свою электронную почту Outlook.com.
  2. В левом верхнем углу нажмите левой кнопкой мыши на значок в форме плитки «Приложения».
  3. После этого откроются доступные онлайн сервисы, среди них Word онлайн.

word в outlook com

  1. Нажмите на значок, приступите к работе с документом.

По умолчанию, в Word онлайн открыт упрощенный интерфейс. Для изменения внешнего вида ленты, войдите в меню «Вид», снимите флажок, напротив пункта «Упрощенная лента». Лента примет привычный вид, как в приложении.

Microsoft Word онлайн в Яндекс Диск

Облачное хранилище Яндекс Диск добавило интеграцию с бесплатными сервисами Office Online. Пользователь может открыть или создать документ Ворд непосредственно из облачного хранилища.

  1. Войдите в Яндекс Диск, например из электронного почтового ящика.
  2. В левом верхнем углу нажмите на кнопку «Создать».
  3. Среди предложенных вариантов выберите «Текстовый документ».

создать текстовый документ

После этого, в окне браузера откроется текстовый процессор Word онлайн.

Ворд онлайн в Облако Mail.Ru

Облако@Mail.Ru поддерживает работу с сервисами Office онлайн. Поэтому из облачного хранилища Облако Mail.Ru пользователи могут создавать текстовые документы Word.

  1. Войдите в Облако Mail.Ru из электронной почты.
  2. В левом верхнем углу нажмите на стрелку около кнопки «Создать папку».
  3. В контекстном меню выберите «Документ».

создать документ

В окне браузера откроется тестовый редактор Word Online.

Выводы статьи

Пользователи могут бесплатно воспользоваться текстовым редактором Word онлайн из состава Office Online. Ворд онлайн доступен из окна браузера на странице Word Online, в электронной почте Outlook.com, из веб-интерфейса в облачных хранилищах OneDrive, Яндекс Диск, Облако Mail.Ru.

Похожие публикации:

  • Как сделать скриншот в Word
  • Как перевернуть текст в Word — 5 способов
  • Как поставить длинное тире в Ворде — 6 способов
  • Как убрать режим ограниченной функциональности Word 2019, 2016, 2013, 2010, 2007
  • Как включить линейку в Word
Skip to content

Speech And Language Kids Logo

Search for Solutions Here:

Word Web Examples | Using Word Webs for Vocabulary

What is a Word Web?

A word web is a graphic organizer that provides more information about a word.  Word webs can help children learn new vocabulary words and connect those words to other words that they already know.  This is a very effective tool for helping to boost vocabulary and language skills for all children, but especially those with language delays.

For more resources on helping boost vocabulary skills in children, click here.

Vocabulary and Question Cards

Vocabulary and Question Flashcards

Basic Vocab and Categories Cards

Word Web Example 1:
Single Word Web

One way to use a word web to expand a child’s vocabulary is to find new words and discuss them at length.  You can do this by creating a word web that maps out the new word.  Go through a book with the child that is at or slightly above his reading level.  Pick out a word from that book that the child doesn’t know the meaning of.  You could also do this with an assigned reading from school.  Chances are those words will come up again.  Draw the following word web on a piece of paper.  If desired, stick that paper in a page protector so that you can write on it with dry erase markers and use it again.

Word Web Example

Write the target word in the middle of the word web and then fill in the circles that surround it.  Use another piece of paper if you need more room.  Here’s what to put in each circle:

Part of Speech:

Include if it is a noun (person/place/thing), verb (action word), adjective (describes a noun), adverb (describes a verb), preposition (location word like on and in), conjunction (combining words like and/but), interjection (ah ha!  Or uh oh!).

Synonyms:

Identify words that mean the same thing as the target word.

Antonyms:

Identify words that mean the opposite of the target word.

Category:

If applicable, talk about what category the word belongs to.  If it is a noun, use categories like “foods” or “clothing”.

Word Parts and Meaning:

Break the word apart into as many pieces as you can that still have some sort of meaning.  For example, the words “balls” can be broken down into the root “ball” and the plural “s”.  “Ball” means the object and “s” means there is more than one.  For another example, “repositioning” could be broken down into “re” (again), “position” (movement or placing), and “ing” (currently happening).  On the other hand, “butterfly” cannot be broken down any further as it is its own thing.  If you broke it down into “butter” and “fly”, it would have a completely different meaning.  Talk about the parts of the word and what each one means.  This will help your child learn to decode other new words when he encounters them.

Function

If it is a noun, talk about the function of that object.  If it is a different part of speech, talk about what role the word has in the sentence.  For example, the conjunction brings two thoughts together.

Descriptors

For nouns, use the five senses to describe the word.  How does it feel, look, taste, sound, and smell?  For verbs, include what adverbs you could use to describe the action.  For the word run, you could use “quickly”, “slowly”, “staggeringly”, etc.

Other Info

Include any other information that you have about that word.

After creating this word web with a child, he will have a much better understanding of what that word means.  You could either erase these pages and start again (such as if you’re using dry erase markers), or put them together into a book for his own personal dictionary.

Word Web Example 2:
Vocabulary Web

If a child is struggling with vocabulary from a particular unit or theme at school, try creating a vocabulary word web for common words that the child might encounter.  Here’s what you can do.

Pick a unit or theme and find an age-appropriate text about that topic.  You can use the child’s textbook or find a book at the library.  Go through the text with the child and pick out 20-30 words that seem to be key vocabulary for that unit.  Many textbooks with include a list of key vocabulary at the beginning or end of the chapter.  Write all of those words on a piece of paper.

Next, look at the list with the child and see if you can find similar traits that would allow you to group the words into categories on your word web.  You could group them by part of speech (see the description above).  You could also group them by topic.  For example, words about The Earth may be grouped by land, water, and sky.

Once you have some groups in mind, create a word web that has the topic/unit in the middle in a circle.  Then create more circles for your groups and have those branching off the topic.  Finally, have each word in its own circle that branches off of one group.  Here’s an example to get you started:

Word Web Example: Vocabulary Web

Keep creating these word webs and the child’s vocabulary will grow like crazy!  You can even have your child decorate them and hang them where he can review them later.

Additional Resources for Teaching Vocabulary to Children

We have more resources for improving vocabulary skills in children.  Check out our other materials here:

Identifying Main Idea and Details Kit

Identifying Main Idea and Details

No-Prep Therapy Materials

Word Finding Therapy Kit

Word Finding Therapy Kit

Activities for Word Retrieval

Speech and Language Therapy Guide

Speech and Language Therapy Guide

Activities for 39 Language Skills

Carrie Clark, Speech-Language Pathologist

About the Author: Carrie Clark, MA CCC-SLP

Hi, I’m Carrie! I’m a speech-language pathologist from Columbia, Missouri, USA. I’ve worked with children and teenagers of all ages in schools, preschools, and even my own private practice. I love digging through the research on speech and language topics and breaking it down into step-by-step plans for my followers.

Fun Fact: Most of the pictures from my oldest version of products came from my roommate and I driving around Missouri taking pictures of things.  We made a trip to the zoo, a farm, and other places so I could get a full, robust photo library to use for my images.  So I apologize if the older stuff has some odd pictures.  Sometimes things were just too hard to find and we had to improvise!

Connect with Me:

Share This Story, Choose Your Platform!

Related Posts

7 Comments

  1. Chris Gerber
    March 23, 2013 at 4:19 pm — Reply

    Thanks Carrie! I’m always looking for vocab ideas for clinic and even thought of an adaptation for the preschool.

    • Wonderful! Feel free to share that adaptation here so others can use it, too!

  2. Your style is unique in comparison to other folks I have read
    stuff from. Thanks for posting when you’ve got the opportunity, Guess I will
    just bookmark this page.

  3. Amazing article written by the author. Thanks for providing me in depth knowledge on how can I expand my vocabulary.

  4. I love grammar! I have been brushing on some writing skills, and this blog helped make certain things very clear. Thank you so much!

    • Kena Roth
      November 23, 2021 at 10:17 am — Reply

      You are very welcome, Fiona! Please let us know if you have any questions.

  5. Interesting ideas that parents can follow through for their kids learning needs.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Page load link

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

Enable or Disable Cookies

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Go to Top

Introduction

Word documents are everywhere and are used for countless tasks so you may have a requirement to support their generation from within your web application or webpage, this could include downloading a C.V from your personal site to the generation of a report based on data from within your web application that can be printed out or emailed by your client.

Goals

Create and save a Word document using only client-side vanilla/plain JavaScript.

Prerequisites

In order to complete this example you should have some basic knowledge of HTML and JavaScript.

Step 1 — Setup project

In order to concentrate on the job in hand and to get up and running as quickly as possible we are going to use CodeSandbox and their vanilla starter project.

A new CodeSandbox project can be created by opening the following link vanilla JavaScript project.

Step 2 — Install dependencies needed to create a Word document

With the project setup we can now install the two modules/dependencies needed to successfully create and save a Word document. The first package (docx) allows you to build your Word document and the second package (file-saver) gives the ability to save the document locally.

Add the two packages using the «Add Dependency» button.

Step 3 — Add a button to create our Word document

Before we start writing the code required to generate our Word documents lets add a button to the index.html file. We can then use this button to fire off the actions needed to generate the Word document.

<!DOCTYPE html>
<html>
  <head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <div id="app"></div>
    <button id="generate">Generate Word Document</button>
    <script src="src/index.js"></script>
  </body>
</html>

Enter fullscreen mode

Exit fullscreen mode

Step 4 — Create a blank Word document

From now one we will be working solely within the index.js JavaScript file, lets start by deleting everything that is currently there as this is not need.

All we will need to create a blank word document is the Document and Packer features from the docx module and the saveAs feature from file-saver module.

import { Document, Packer } from "docx"
import { saveAs } from "file-saver"

Enter fullscreen mode

Exit fullscreen mode

Next add an event listener that is listening for clicks on the button we created in Step 3.

// Listen for clicks on Generate Word Document button
document.getElementById("generate").addEventListener(
  "click",
  function(event) {
    generateWordDocument(event)
  },
  false
)

Enter fullscreen mode

Exit fullscreen mode

Once the event listener is triggered we will call a function that will create a new instance of Document from the docx module and send this instance to a saveDocumentToFile function.

function generateWordDocument(event) {
  event.preventDefault()
  // Create a new instance of Document for the docx module
  let doc = new Document()
  // Call saveDocumentToFile with the document instance and a filename
  saveDocumentToFile(doc, "New Document.docx")
}

Enter fullscreen mode

Exit fullscreen mode

The saveDocumentToFile function creates a new instance of Packer from the docx modules, Packers in docx are used to turn your JavaScript code into a .docx file. We then send our document instance to Packers toBlob function which in turn converts our instance of Document into a Blob object, a mimeType is added to the Blob and finally the Blob is sent to saveAs feature of the file-saver module which will create the file and prompt you to save or open.

function saveDocumentToFile(doc, fileName) {
  // Create new instance of Packer for the docx module
  const packer = new Packer()
  // Create a mime type that will associate the new file with Microsoft Word
  const mimeType =
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
  // Create a Blob containing the Document instance and the mimeType
  packer.toBlob(doc).then(blob => {
    const docblob = blob.slice(0, blob.size, mimeType)
    // Save the file using saveAs from the file-saver package
    saveAs(docblob, fileName)
  })
}

Enter fullscreen mode

Exit fullscreen mode

Clicking the ‘Generate Word Document’ button will now create and save a blank Word document.

Step 5 — Create content of the Word document

We can now start adding some content to the Word document. We will simply add a title, subtitle, two headings and a long paragraph as this will make it easier to understand once we come to start styling the document.

function generateWordDocument(event) {
  event.preventDefault()
  let doc = new Document()
  doc.createParagraph("Title")
  doc.createParagraph("Subtitle")
  doc.createParagraph("Heading 1")
  doc.createParagraph("Heading 2")
  doc.createParagraph(
    "Aliquam gravida quam sapien, quis dapibus eros malesuada vel. Praesent tempor aliquam iaculis. Nam ut neque ex. Curabitur pretium laoreet nunc, ut ornare augue aliquet sed. Pellentesque laoreet sem risus. Cras sodales libero convallis, convallis ex sed, ultrices neque. Sed quis ullamcorper mi. Ut a leo consectetur, scelerisque nibh sit amet, egestas mauris. Donec augue sapien, vestibulum in urna et, cursus feugiat enim. Ut sit amet placerat quam, id tincidunt nulla. Cras et lorem nibh. Suspendisse posuere orci nec ligula mattis vestibulum. Suspendisse in vestibulum urna, non imperdiet enim. Vestibulum vel dolor eget neque iaculis ultrices."
  )
  saveDocumentToFile(doc, "New Document.docx")
}

Enter fullscreen mode

Exit fullscreen mode

The Word document will now look something like this

Step 6 — Style the Word document

Now that we have some content we can look at styling the document.

Firstly we will create a theme object that will hold all the information about which fonts and colours we want to use.

function generateWordDocument(event) {
  event.preventDefault()
  // Create new instance of Document for the docx module
  let doc = new Document()
  doc.theme = {
    font: {
      normal: {
        family: "Calibri",
        color: "303856",
      },
      header: { family: "Calibri Light" },
    },
    title: {
      color: "4ABDAC",
    },
    headings: {
      one: {
        color: "FC4A1A",
      },
      two: {
        color: "F7B733",
      },
    },
  }
  ...
  ...
  // Call saveDocumentToFile withe the document instance and a filename
  saveDocumentToFile(doc, "New Document.docx")
}

Enter fullscreen mode

Exit fullscreen mode

After creating the theme object we can start creating our styles. We will create 5 styles

  • Custom Heading 1
  • Custom Heading 2
  • Custom Title
  • Custom Subtitle
  • Custom Normal

These should tie up nicely to the content that we created in Step 5.

You can learn more about styles in Microsoft Word here

function generateWordDocument(event) {
  event.preventDefault()
  // Create new instance of Document for the docx module
  let doc = new Document()
  ...
  ...
  doc.Styles.createParagraphStyle("customHeading1", "Custom Heading 1")
    .basedOn("Heading 1")
    .next("Normal")
    .quickFormat()
    .font(doc.theme.font.header.family)
    .size(32)
    .bold()
    .color(doc.theme.headings.one.color)
    .spacing({ after: 250 })

  doc.Styles.createParagraphStyle("customHeading2", "Custom Heading 2")
    .basedOn("Heading 2")
    .next("Normal")
    .quickFormat()
    .font(doc.theme.font.header.family)
    .size(26)
    .bold()
    .color(doc.theme.headings.two.color)
    .spacing({ after: 150 })

  doc.Styles.createParagraphStyle("customTitle", "Custom Title")
    .basedOn("Title")
    .next("Normal")
    .quickFormat()
    .font(doc.theme.font.header.family)
    .size(56)
    .bold()
    .color(doc.theme.font.normal.color)
    .spacing({ after: 250 })

  doc.Styles.createParagraphStyle("customSubtitle", "Custom Subtitle")
    .basedOn("Subtitle")
    .next("Normal")
    .quickFormat()
    .font(doc.theme.font.header.family)
    .size(22)
    .color(doc.theme.font.normal.color)
    .spacing({ after: 150 })

  doc.Styles.createParagraphStyle("customNormal", "Custom Normal")
    .basedOn("Normal")
    .quickFormat()
    .font(doc.theme.font.normal.family)
    .size(20)
    .color(doc.theme.font.normal.color)
    .spacing({ after: 150 })
  ...
  ...
  // Call saveDocumentToFile withe the document instance and a filename
  saveDocumentToFile(doc, "New Document.docx")
}

Enter fullscreen mode

Exit fullscreen mode

With our styles in place we can apply them to our content.

function generateWordDocument(event) {
  event.preventDefault()
  // Create new instance of Document for the docx module
  let doc = new Document()
  ...
  ...
  doc.createParagraph("Title").style("customTitle")
  doc.createParagraph("Subtitle").style("customSubtitle")
  doc.createParagraph("Heading 1").style("customHeading1")
  doc.createParagraph("Heading 2").style("customHeading2")
  doc
    .createParagraph(
      "Aliquam gravida quam sapien, quis dapibus eros malesuada vel. Praesent tempor aliquam iaculis. Nam ut neque ex. Curabitur pretium laoreet nunc, ut ornare augue aliquet sed. Pellentesque laoreet sem risus. Cras sodales libero convallis, convallis ex sed, ultrices neque. Sed quis ullamcorper mi. Ut a leo consectetur, scelerisque nibh sit amet, egestas mauris. Donec augue sapien, vestibulum in urna et, cursus feugiat enim. Ut sit amet placerat quam, id tincidunt nulla. Cras et lorem nibh. Suspendisse posuere orci nec ligula mattis vestibulum. Suspendisse in vestibulum urna, non imperdiet enim. Vestibulum vel dolor eget neque iaculis ultrices."
    )
    .style("customNormal")
  // Call saveDocumentToFile withe the document instance and a filename
  saveDocumentToFile(doc, "New Document.docx")
}

Enter fullscreen mode

Exit fullscreen mode

Clicking the ‘Generate Word Document’ button now will create a Word document that look something like this

Conclusion

With the use of a couple of great packages we can easily create a nice looking Word document using solely client side JavaScript. Docx is very powerful and this article only covers the basics to get you up and running with a simple Word document.

Complete Example

A complete example of the code can be found here

Like this post? Please share to your friends:
  • Creating a word search in word
  • Creating a what if formula in excel
  • Creating a template with word
  • Creating a template in excel
  • Creating a sheet in excel vba