Поделиться через


Надстройки Office запрашивают GitHub Copilot

Библиотека запросов надстроек Office — это коллекция примеров запросов для использования с GitHub Copilot при разработке надстроек Office. GitHub Copilot — это программист пар ИИ, который помогает писать код. Он доступен в качестве расширения для многих редакторов кода, таких как Visual Studio Code и Visual Studio. Вы можете установить и запустить расширения непосредственно с помощью редактора кода.

Скопируйте запросы из этой статьи и введите их в чат GitHub Copilot, чтобы начать экспериментировать. Вы также можете открыть список запросов в редакторе кода, скачав файл из GitHub в разделе Office Add-ins prompts для GitHub Copilot на GitHub.

Важно!

Запросы в этой статье предназначены для работы с GitHub Copilot на английском языке. Они были протестированы, чтобы убедиться, что Copilot возвращает соответствующие ответы, но генеративный ИИ может по своей природе возвращать переменные ответы. Перед публикацией или распространением надстройки среди пользователей всегда проверяйте код, созданный GitHub Copilot.

Мы рекомендуем настроить собственные запросы на разработку надстроек Office с помощью GitHub Copilot. Чтобы добавить свои идеи в эту библиотеку запросов, ознакомьтесь с руководством по добавлению документации по надстройкам Office на сайте GitHub. Вы также можете поделиться своими подсказками и отзывами в опросе на странице Отзыв о подсказках надстроек Office.

Примеры запросов

В следующих разделах содержатся запросы для нескольких сценариев при разработке и публикации надстроек.

Совет

Переключение фраз между звездочками в запросах, чтобы поэкспериментировать со связанными сценариями.

Руководство по началу работы

Show me the typical structure of an Office Add-in project and 
explain the functionality of each file. Explain the steps and 
commands to get started in *Visual Studio Code*.

Создание проекта надстройки

Импорт документа в виде шаблона Word

Create an Office JavaScript add-in for *Word* to *import a 
document as a template*. List the steps to follow in *Visual 
Studio Code* to create the add-in and insert code snippets in 
the correct files.

Создание пользовательской функции в Excel

Create an Office JavaScript Add-in for *Excel* to *create a
custom function in Excel*. List the steps to follow in *Visual 
Studio Code* to create the add-in and insert code snippets in 
the correct files.

Вставка графики в слайд презентации PowerPoint

Create an Office JavaScript Add-in for *PowerPoint* to *insert 
graphics into a presentation slide*. List the steps to follow in 
*Visual Studio Code* to create the add-in and insert code snippets 
in the correct files.

Реализация функции для надстроек Excel

Добавление листа

Add a new worksheet *at the end* using the Excel JavaScript API.

Получение данных из таблицы

Retrieve the data in the range *A1:B3 on the first worksheet* 
using the Excel JavaScript API.

Создание диаграммы

Insert a line chart titled *"My chart"* into the current worksheet 
using the data *in the range A1:B3* using the Excel JavaScript API.

Создание пользовательской функции для выполнения вычислений в Excel

Create a JavaScript custom function in Excel that conducts a 
calculation.

Обработка событий

Handle an event *when selection changes in worksheet* using 
Excel JavaScript API.

Создание фигур

Create *a yellow square* shape in the worksheet using the Excel 
JavaScript API.

Вставка копии существующей книги в текущую книгу.

Insert a workbook template as Base64 in the current workbook using 
insertWorksheetsFromBase64 Excel JavaScript API.

Реализация функции для Word надстроек

Вставка абзаца

Insert a paragraph with the content *"My paragraph"* at the start 
of the document using the Word JavaScript API.

Применение стиля к абзацу

Apply the style *"Heading1"* to the first paragraph in the document 
using the Word JavaScript API.

Изменение шрифта

Change the font formatting of *the selected document text* using 
the Word JavaScript API.

Вставка таблицы в документ

Insert a table named "Sample table" with sample data in the 
document using the Word JavaScript API.

Вставка элемента управления содержимым

Insert a content control labeled *"Sample Content Control"* into the 
first paragraph and *set the content control's color to red* using 
the Word JavaScript API.

Добавить комментарий

Insert a comment into the document selection using the Word JavaScript API

Вставка документа в целевой документ в определенном расположении

Import a file from local storage as a template to the current
document using the Word JavaScript insertFileFromBase64 API.

Реализация функции для надстроек Excel, PowerPoint или Word

Добавление диалогового окна

Show a dialog in the application *when a user clicks a button 
in the add-in* using the Office JavaScript API.

Получение токена доступа

Get an access token in an Office Add-in using the Office 
JavaScript API to authenticate the user with external services 
or APIs.

Руководство по публикации надстроек

Распространение надстройки в организации

Tell me how to deploy and distribute the local Office JavaScript 
add-in code to *all employees in my organization* after 
development. Provide the steps to follow.

Распространение надстройки в хранилище надстроек

Tell me how to deploy and distribute the local Office JavaScript 
add-in code to the *add-in store* after development. Provide the 
steps to follow.

См. также