Letysite.ru

IT Новости с интернет пространства
0 просмотров
Рейтинг статьи
1 звезда2 звезды3 звезды4 звезды5 звезд
Загрузка...

Create word document

How to Create Word Documents with Node.js

Microsoft Word is a very popular word processor. It is a popular format for making and exchanging documents. Therefore, a feature of a lot of apps is to create Word documents from other kinds of documents. Creating Word documents is easy in Node.js apps with third party libraries. We can make an app from it easily ourselves.

In this article, we will make an app that lets users enter their document in a rich text editor and generate a Word document from it. We will use Express for back end and React for front end.

Back End

We will start with the back end. To start, we will create a project folder with the backend folder inside. Then in the backend folder run npx express-generator to create the Express app. Then run npm i to install the packages Next we install our own packages. We need Babel for run the app with the latest version of JavaScript, CORS for cross domain requests with front end, HTML-DOCX-JS for converting HTML strings to Word documents, Multer for file upload, Sequelize for ORM, and SQLite3 for our database.

We install all of these by running npm i @babel/cli @babel/core @babel/node @babel/preset-env cors html-docx-js sequelize sqlite3 multer .

After that we change the scripts section of package.json to have:

so that we run our app with Babel instead of the regular Node runtime.

Then create a .babelrc file in the backend folder and add:

to specify that we run our app with the latest version of JavaScript.

Next we add our database code. Run npx sequelize-cli init in the backend folder to create the Sequelize code.

We should have a config.js in the project now. In there, add:

to specify that we SQLite for our database.

Next create our model and migration by running:

to create a Document model and Documents table.

to create the database.

Next we create our routes. Create a document.js file in the routes folder and add:

We do the standard CRUD operations to the Documents table in the first 4 routes. We have GET for getting all the Documents , POST for create a Document from post parameters, PUT for updating Document by ID, DELETE for deleting a Document by looking it up by ID. We have the HTML in the document field for generating the Word document later.

The generate route is for generating the Word document. We get the ID from the URL and then use the HTML-DOCX-JS package to generate a Word document. We generate the Word document by converting the HTML document to a file stream object with the HTML-DOCX-JS package and then writing the stream to a file and saving the path to the file in the Document entry in with the ID in the URL parameter.

We also have a uploadImage route to let user upload images with CKEditor with the CKFinder plugin. The plugin expects uploaded and url in the response so we return those.

Then we need to add a files folder in the backend folder.

Next in app.js , we replace the existing code with:

We expose the file folder with:

and expose the document route with:

Front End

Now the back end is done, we can move onto the front end. Create the React app by running Create React App. We run npx create-react-app frontend in the root folder of the project.

We then install our packages. We will use CKEditor for our rich text editor, Axios for making HTTP requests, Bootstrap for styling, MobX for simple state management, React Router for routing URLs to components, and Formik and Yup for form value handling and form validation respectively.

Install all the packages by running npm i @ckeditor/ckeditor5-build-classic @ckeditor/ckeditor5-react axios bootstrap formik mobx mobx-react react-bootstrap react-router-dom yup .

With the packages installed, we can get started. In App.js , we replace the existing code with:

to add our top bar and route to the home page.

In App.css , we replace the existing code with:

to add some padding to our page and style the validation message for the Rich text editor, and change the color of the navbar .

Next we create the form for adding and editing documents. Create a DocumentForm.js in the src file and add:

We wrap our React Bootstrap Form inside the Formik component to get the form handling function from Formik which we use directly in the React Bootstrap form fields. We cannot do the same with CKEditor, so we write our own form handlers for the rich text editor. We set the data prop in the CKEditor to set the value of the input of the rich text editor. The onInit function is used with users try to edit an existing document since we have to set the data prop with the editor initializes by running setContent(doc.document); . The onChange prop is the handler function for setting content whenever it is updated so the data prop will have the latest value, which we will submit when the user clicks Save.

We use the CKFinder plugin to upload images. To make it work, we set the image upload URL to the URL of the upload route in our back end.

The form validation schema is provided by the Yup schema object which we create at the top of the code. We check if the name field is filled in.

The handleSubmit function is for handling submitting the data to back end. We check both the content and the evt object to check both fields since we cannot incorporate the Formik form handlers directly into the CKEditor component.

If everything is valid, then we add a new document or update it depending on on whether the edit prop is true or not.

Then when saving is successful, we call getAllDocuments to populate the latest documents into our MobX store by running documentStore.setDocuments(response.data); .

Next we make our home page by creating HomePage.js in the src folder and add:

We have a React Bootstrap table for listing the documents with buttons to edit, delete documents and generate Word document. Also, there is a Open link for opening the Word document in each row. We have a create button on top of the table.

When the page loads, we call getAllDocuments and populate them in the MobX store. We open and close the add and edit modals with the openAddTemplateModal , closeAddModal , cancelAddModal , cancelEditModal functions.

Next create request.js in the src folder and add:

to add the functions to make requests to our routes in the back end.

Then we create our MobX store. Create store.js in the src folder and put:

We have the function setDocuments to put the photo data in the store, which we used in HomePage and DocumentForm and we instantiated it before exporting so that we only have to do it in one place.

designates the documents array in DocumentStore as the entity that can be watched by components for changes. The setDocuments function is designated as the function that can be used to set the documents array in the store.

Next we create the top bar by creating a TopBar.js file in the src folder and add:

This contains the React Bootstrap Navbar to show a top bar with a link to the home page and the name of the app. We only display it with the token present in local storage. We check the pathname to highlight the right links by setting the active prop.

Читать еще:  Чекбокс в word

Next in index.html , we replace the existing code with:

to add the Bootstrap CSS and change the title.

After writing all that code, we can run our app. Before running anything, install nodemon by running npm i -g nodemon so that we don’t have to restart back end ourselves when files change.

Then run back end by running npm start in the backend folder and npm start in the frontend folder, then choose ‘yes’ if you’re asked to run it from a different port.

Microsoft Word
Creating Accessible Documents

You are here: Home > Articles > Microsoft Word — Creating Accessible Documents

Article Contents

  1. Current page: Page 1: Microsoft Word — Creating Accessible Documents
    1. Introduction
    2. Headings
    3. Alternative Text for Images
    4. Data Tables
    5. Links
    6. Lists & Columns
    7. Accessibility Checker
    8. Converting to HTML
    9. Converting to PDF
    10. Other Principles
    11. Principles into Practice
  2. Page 2: Word 2010 for Windows
  3. Page 3: Word 2011 for Mac
  4. Page 4: Word 2013 for Windows
  5. Page 5: Word 2016 for Windows
  6. Page 6: Word 2016 for Mac

WebAIM offers an four-week online course on document (Word, PowerPoint, and PDF) accessibility. Learn more about the Document Accessibility Course.

Introduction

Microsoft Word is currently the most widely-used word processor on the market. Because it is so common, the .doc format has become the de facto format for text documents. MS Word is often used to create PDF and HTML files for websites. Despite some gains in recent years, creating accessible web content with Word is NOT a straightforward process.

The following best practices are provided to help you maximize the accessibility of your Word documents. On this page you will find general principles for increasing accessibility in all versions of Word.

When you are ready to put these recommendations into practice, select your version of Word from the article contents, or at the bottom of this page.

Headings

A uniform heading structure is often the most important accessibility consideration in Word documents. When encountering a lengthy Word document, sighted users often scroll the page quickly and look for big, bold text (headings) to get an idea of its structure and content. Screen reader and other assistive technology users also have the ability to navigate Word documents by heading structure, assuming Word’s Heading styles are used.

Structure through hierarchy

Pages should be structured in a hierarchical manner:

  • A Heading 1 is usually a page title or a main content heading. It is the most important heading, and there is generally just one.
  • A Heading 2 is usually a major section heading.
  • A Heading 3 is usually a sub-section of the Heading 2.
  • A Heading 4 is usually a sub-section of the Heading 3, and so on, ending with Heading 6 .

Technically, lower-degree headings should be contained within headings of the next highest degree. One should not skip heading levels, such as using a Heading 4 directly below a Heading 2 .

The following outline shows an example of hierarchy. In fact, it is linked to the hierarchy used in part of this page. To experience how an assistive technology user would navigate through a Word document with a proper heading structure, click on any of the heading links to jump to that section of this page.

Navigation through structure

Word documents with a proper heading structure provide screen reader and other assistive technology users with the structure to navigate by:

  • Viewing a list of all of the headings on the page.
  • Choosing top-level headings (Heading 1), next-level headings (Heading 2), third-level headings (Heading 3), and so on.
  • Reading or jumping by headings.

«Headings» created with font styles

Unfortunately, it is a common practice to create a «heading» by changing the text directly in a Word document. A user will highlight the text and apply a different font type, a larger font size, bold formatting, etc. While these changes made with Font styling will provide visual structure for some of your users, the document structure needed for navigation by assistive technology users is missing. For this reason, use the Heading tool provided by Word.

Alternative Text for Images

Alternative text is needed in Word documents to provide a non-visual means of representing the CONTENT or FUNCTION of an image. There is more than one way to provide «alt text», but all images contained in a Word document must have it.

Image types in Word documents that can be given alternative text include:

  • pictures
  • illustrations
  • images of text
  • shapes
  • charts
  • SmartArt
  • embedded objects

When alt text is added correctly to an image, screen reading software can «read» it in a Word, PDF or HTML file.

Adding alternative text

There are multiple ways to provide alt text in Word documents:

  • Use the Description field in the Alt Text field, OR
  • Provide information about the content or function of the image in the surrounding text.

When the equivalent text cannot be provided succinctly in text near the image, you may link to another section of the document (e.g., an appendix) or to an accessible web page.

Best practices for alternative text

Alternative text should be:

  • Accurate and equivalent—present the same content or function as the image.
  • Succinct—no more than a few words are necessary; rarely a short sentence or two may be appropriate.
  • NOT be redundant—do not provide information that is in the surrounding text.
  • NOT use descriptive phrases—screen reading software identifies images, so do not use phrases such as «image of. » or «graphic of. «.

Data Tables

The purpose of data tables is to present information in a grid, or matrix, and to have columns or rows that show the meaning of the information in the grid. Sighted users scan a table to make associations between data in the table and their appropriate row and/or column headers. Screen reader users make these same associations with tables in web pages and PDF files. Unfortunately support for table headers is limited in Word. You can add properties to Word documents so that column headers (headers in the first row of the table) are identified by a screen reader and read and when exported to PDF. Unfortunately, row headers (headers in the first column of the table) do not have the same level of support.

Links

Hyperlinks in Word documents allow users to visit web pages, navigate to Word Headings and Bookmarks , and open email links.

Creating links in Word

Hyperlinks are usually created in Word by pasting the complete URL of a web page into a document and hitting Space , Enter , or some other key. Word automatically creates a link, and uses the URL as the display text (e.g., http://webaim.org/techniques/word/). Because the URL text may not make sense to a user, we recommend editing Word’s default link text.

Follow these principles to create accessible links:

  • Use descriptive link text that does not rely on context from the surrounding text.
  • Keep the amount of text in the link to a minimum.
  • Use underlined text with a color that stands out from the surrounding text.

Screen reader users may skim a document by navigating from link to link. Avoid ambiguous link text that is difficult to understand out of context (e.g., «click here»).

Lists & Columns

Lists and columns add important hierarchical structure to a document. Sometimes users create «lists» and «columns» manually by hitting the Tab to indent content. While this provides visual structure for sighted users, it does not provide the document structure needed for assistive technology users.

List types

There are two types of lists used in Word: ordered and unordered. Ordered (numbered) lists are used to present a group of items (words, phrases, sentences) that follow a sequence:

  1. Preheat grill with «high» heat setting.
  2. Cook hamburgers on «medium» heat setting.
  3. Flip hamburgers when juices are visible on the top of the patty.
  4. Remove hamburgers when the inside temperature is 160℉.
Читать еще:  Медленно печатает принтер hp документы word

Unordered (bullet) lists are used for a group of items without a sequence:

Accessibility Checker

Word for Windows provides an Accessibility Checker for identifying and repairing accessibility issues. The checker’s Inspection Results classifies accessibility issues into three categories:

  • Errors: content that makes a document very difficult or impossible for people with disabilities to access.
    • Example: an image with no alt text.
  • Warnings: content that in most—but not all—cases makes the document difficult for people with disabilities to access.
    • Example: a link with text that is not descriptive of its function.
  • Tips: content that people with disabilities can access, but that might be better organized or presented.
    • Example: skipping from a first-level heading to a third-level heading.

Clicking an item in the results highlights the corresponding item in the document and displays the Additional Information section:

  • Why Fix: explains why the issue impacts accessibility.
  • How to Fix: suggestions for repairing the issue.

Converting to HTML

Document structure and alternative text that has been added correctly will be retained when saving a Word document as an HTML file.

The Single File Web Page will save document properties and more Word information, but the file will be much larger. The Web Page option saves pictures in a separate folder, and creates a page that looks almost exactly like the original document. Microsoft recommends using the Web Page, Filtered option. A filtered webpage keeps only the content, style instructions, and some other information, for a small file size, without a lot of extra code.

Converting to PDF

Many Word documents end up as PDF files. It is a convenient way to preserve formatting and accessibility information, assuming the file is converted correctly. Read more on converting a Word document to accessible PDF in our Acrobat/PDF article.

Make sure that you have the right version of Acrobat for your version of Word. Some accessibility information may still need to be added in Acrobat Professional.

Other Principles

  • Use simple language.
  • Ensure that font size is sufficiently large—generally a minimum of 11 points.
  • Provide sufficient contrast between text colors and background colors.
  • Do not use color as the ONLY way to convey content.
  • Be careful with the use of watermarks. They can impact readability and create low contrast.
  • Provide a table of contents for long documents.

Principles into Practice

Ready to get started? Select your version of Word:

How to create a document

To create a document, you must either have a word processor or a computer capable of creating a document on an online service.

When we refer to a «document,» we’re talking about a rich text document with text formatting (e.g., bold), images, different fonts, and font sizes, and not a plain text file. See our how to create a text file page for steps on making a text-only file.

The most common and widely used word processor program is Microsoft Word. However, because of all of the different needs of users today, we’ve included additional options that are available for creating a document.

Create a document with Google Docs

Google Docs is one of our favorite solutions for most users, especially those who are new computers. The reasons we like it are because it’s free, easy to access, supports collaborative editing, can open other document files, and may be accessed from many devices. To create a document in Google Docs, follow the steps below.

Create a blank document

  1. Open Google Drive. If prompted, log into your Google account.
  2. In the upper-left corner of the window, click the button.
  3. In the drop-down menu that appears, move your mouse cursor over the arrow next to Google Docs.

  1. Choose Blank document from the box that appears.

Create a document using a template

  1. Complete steps 1-3 in the previous section.
  2. Choose From a template from the box that appears.

  1. Select a template from the window that appears.

Your newly-created document may be accessed in the My Drive section (first tab in the left menu).

Creating a document with Microsoft Word

To use Microsoft Word to open a document, follow the steps below.

Open Word in Windows

  1. Open Microsoft Word. If you’re not sure how to open or find Word, skip to the finding Microsoft Word section.
  2. In newer versions of Word, the first screen will ask what type of Word document you want to create. Select the «Blank document» option to create a document from scratch. You can also select from one of the Word templates provided if you would like to create a specific type of document.
  3. Once the blank document or template is open, any new information can be entered using a keyboard or on-screen keyboard.
  4. Once complete or while working on the document, you can Save through the File tab at the top of the Word program window.

How to find Microsoft Word in Windows

  1. In Windows, click Start.
  2. In the search box, type word. If Word is installed, it shows in the search results. For example, you may see Microsoft Word 2010, Microsoft Word 2013, or Microsoft Word 365.

In Windows 10, the search box is on the Taskbar next to Start. In Windows 8, start typing word on the Start page and the search results show on the right side of the screen.

Word and WordPad are two different programs. See the creating a document with Microsoft WordPad section below for further information on this program.

How to install Microsoft Word

If Word is not found, it needs to be installed before it can be run, or one of the other free alternatives can be used. Today, the latest version of Word is included in Office 365 and requires a subscription. You can download Office 365, which includes Excel, Word, and other Office applications, from the Office 365 website.

If you’ve purchased Office or Word in the past, older versions of Office can also be installed on newer computers, even those running Windows 8 or Windows 10. You must have the installation discs to install Office or Word again.

How to open a new document if a Microsoft Word document is already open

Press the shortcut keys Ctrl+N simultaneously to open a new document.

  1. Click File in the file menu or the File tab at the top of the program window.
  2. Select the New option.
  3. A prompt should open that presents you with several options. Select the Blank document option.

Creating a document with Microsoft WordPad

Microsoft WordPad is a free rich-text editor included with Microsoft Windows for viewing and editing rich-text files (.RTF, .DOCX, and .ODT) files. WordPad can perform basic text formatting like changing the font, alignment, and even inserting multimedia. However, keep in mind that it does not support all formatting options in .DOCX and .ODT files, so some formatting may be incorrect. To open WordPad, follow the steps below.

  1. In Windows, click Start.
  2. In the search box, type wordpad and select the WordPad application in the search results. Once open, you should see a blank window similar to the example below.

In Windows 10, the search box is on the Taskbar next to Start. In Windows 8, start typing wordpad on the Start page and the search results show on the right side of the screen.

  1. Type and create the document how you want it to appear.
  2. After changes are made to your document, you can save the file in the File section.

If WordPad is already open and you want to create a new document

Press the shortcut keys Ctrl+N simultaneously to open a new document.

Читать еще:  1с comобъект word application

In the menu bar, click File and select New. If the File tab or menu is not available, click the blue Menu tab in the top-left corner of the window and select New from the drop-down menu.

Creating a document with LibreOffice and OpenOffice

LibreOffice and OpenOffice Writer are other great free products that allow anyone to create documents on their computer and can even support most of the features in Word. Below are the steps on how to run LibreOffice and OpenOffice in Windows.

Open LibreOffice and OpenOffice in Windows

  1. In Windows, click Start.
  2. In the search box, type writer. If LibreOffice or OpenOffice is installed, either LibreOffice Writer or OpenOffice Writer show in the search results.

In Windows 10, the search box is on the Taskbar next to Start. In Windows 8, start typing writer on the Start page and the search results show on the right side of the screen.

How to install LibreOffice or OpenOffice

LibreOffice is available for download on the LibreOffice website and OpenOffice is available for download on the OpenOffice website.

Once either of these programs are installed, you can follow the steps above to create a document.

Creating a document with AbiWord

AbiWord is another great free product and solution for creating documents on your computer. Below are the steps on how to create a document with AbiWord.

  1. Open AbiWord.
  2. Click File and New or press the shortcut Ctrl+N to create a new document.
  3. Type the document you want to create.
  4. Save the document by clicking File > Save or pressing the shortcut key Ctrl+S.

Коллекция Word Documents

Наконец то я смогу написать статью с примерами. Дело в том, что ключевым компонентом объектной модели Word является не сам объект Word.Application, а коллекция Documents, так как именно она предоставляет два ключевых метода – для создания и открытия документа Word. Конечно, у коллекции Word Documents есть и другие методы и свойства, но они не столь важны. И поэтому, мы рассмотрим только самые основные.

Сама по себе коллекция Documents хранит в себе набор всех объектов Document, которые в свою очередь позволяют работать с каждым экземпляром документа в отдельности. Я буду приводить примеры как в самом редакторе VBA, как и с помощью сценариев Windows Scrip Host.

Единственно свойство, которое позволяет узнать общее количество элементов коллекции является Count:

Count – содержит количество открытых в данный момент документов.

Для примера, откройте несколько word документов и в редакторе VBA пропишите следующий код (просто создайте новый модуль):

В данном случае мы использовали два способа бля работы с коллекцией:

  • Использовали цикл for each для обработки коллекции
  • Использовали свойство count для определения количества элементов в коллекции Documents.

Оба способа позволяют получить имена всех документов открытых в данный момент.

Однако, если мы попробуем проделать аналогичный фокус в сценарии Windows script Host, то никакого результата не получим:

Видимо из внешнего сценария мы можем обработать только ту коллекцию, которую создали тут же.

Методы коллекции Word Documents

Хорошо, теперь давайте рассмотрим некоторые методы коллекции Word Documents, один из методов мы уже использовали выше (Item).

Add (Template, NewTemplate, DocumentType, Visible) – отвечает за создание нового документа, который сразу же открывается, можно выполнить метод без параметров. Параметры:

    Template – задает шаблон для нового документа

При отсутствии параметров, будет создан чистый документ на основе шаблона Normal.dot.

Обратите внимание, что свойство Visible есть и у объекта Word Application, там оно позволяет показать или скрыть все экземпляры объекта Application.

Ниже привожу пример, сценария, в котором создается пять документов, выводится их количество и далее они закрываются:

Item (index) переход к заданному элементу коллекции по его индексу. Значение индекса можно задавать как через метод, так и через коллекцию, так как метод Item используется по умолчанию. Следующие две строки кода являются эквивалентными:

Open (FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format) – открыть заданный документ

  • FileName – только этот параметр является обязательным, содержит путь к файлу, если надо открыть несколько документов, то имена разделяются пробелами.
  • ConfirmConversions – содержит логическое значение, определяющее, надо ли отображать (TRUE) или нет (FALSE) отображать диалоговое окно Convert File, если документ записан не в формате Word.
  • ReadOnly – определяет, открывать ли документ только для чтения (значение TRUE).
  • AddToRecentFiles – если значение TRUE, то документ добавляется к списку файлов внизу меню Файл.
  • PasswordDocument, PasswordTemplate – пароль к документу или пароль к шаблону, соответственно. Application Documents Word.
  • Revert – если данный параметр содержит значение TRUE, то при попытке открыть уже открытый документ, сделанные в нем изменения не будут сохраняться. Если значение FALSE – произойдет простая активизация документа.
  • WritePasswordDocument – пароль, который запрашивается при сохранении документа.
  • WritePasswordTemplate — пароль, который запрашивается при сохранении шаблона.
  • Format – параметр содержит параметр для преобразования файла. Значения: wdOpenFormatAuto (по умолчанию), wdOpenFormatDocument, wdOpenFormatRTF, wdOpenFormatTemplate, wdOpenFormatText, wdOpenFormatUnicodeText.

Save () и Close () – сохранение и закрытие (соответственно) всех документов в заданной коллекции.

Спасибо за внимание. Автор блога Владимир Баталий

Создание документа Word из Excel

при этом создаёт таблицу

если создаю документ при помощи

Создание документа Word по шаблону из Excel
Пытаюсь создать документ Word из шаблона. Необходимо в шаблон добавить текст. Добавляю но шаблон.

Создание документа Word из таблицы Excel
Доброе время суток! Не отправляйте, пожалуйста, в поиск, прочитав название темы. В тексте я.

Добавление срок в таблицу Word при заполнении документа Word из данных Excel
Всем привет! Я новичок в этом деле и нужна помощь. Есть таблица Excel с данными на основании.

Сохранение документа Word из макроса Excel
Макросом Excel формирую в рабочей книге в ячейке B3 имя для документа Word (типа itogi_050914.doc).

bizard, в программе Word свойство Selection относится к объекту Window. У объекта Document нет свойства Selection.

Чтобы проще было писать код, в программе Excel в VBA нужно подлючить библиотеку:
ToolsReferences..Microsoft Word Object Library.

В этом случае, когда ставите точку, то будут всплывающие подсказки.

Переменные в этом случае можно так создавать:

сделал как вы сказали
это он проглотил
застопорился на .Font.Size = 11
убрал пока эту строчку
пошёл выполнять Call ШАПКА

и тут затык на .TypeText Text:= _


что ему ещё надо ведь со строчкой .Documents.Add DocumentType:=wdNewBlankDocument
всё работало и создавало кроме таблицы

Большое спасибо, вроде дошло на ночь глядя.
С наступающим Новым годом! Всего самого наилучшего вам в новом году.

Добавлено через 10 часов 59 минут
ещё пару вопросов
ActiveDocument.Content.Font.Size = 11 не хотит работать
.Content.Font.Size = 11 так работает

Теперь ругается на .TypeParagraph
как правильно написать
.Content.TypeParagraph не подходит
ActiveDocument.TypeParagraph тоже

bizard, сначала делайте код в программе Word.
Когда ставите точку, то появляются члены, которые есть у объекта. Если среди членов нет нужного, значит у объекта нет этого члена. Есть случаи, что не все члены появляются после того, как поставишь точку, но такое редко бывает.

TypeParagraph — является членом объекта Selection. Если вы перейдёте в программу Word, октроете программу VBA, введёте ActiveDocument и поставите точку, то во всплывающей подсказке не будет TypeParagraph. Это означает, что у объекта ActiveDocument нет члена TypeParagraph (могут быть исключения — член не появляется, но есть, но это бывает редко).

bizard, чтобы в документ Word занести данные, нужно указать место, куда эти данные занести.

Для указания места используются следующие объекты:

  1. Selection;
  2. Range. В некоторых случаях, для удобства чтения кода, вместо слова Range используется слово Content.

При использовании макрорекордера, вы получает код с объектом Selection.
Соответственно для объекта Range нельзя получить код с помощью макрорекордера и нужно обратиться к встроенной справке VBA или же искать ответы на свои вопросы, делая запросы в Гугл или Яндекс.

Ссылка на основную публикацию
Adblock
detector