Html вставка word документа

Вставить документы Оффиса можно при помощи плавающего фрейма <IFRAME>. Для этого достаточно указать только адрес вставляемого документа и размеры фрейма. Если размеры фрейма не указывать, то размер на странице будет: width — 300 пикселов, height — 150 пикселов (это значение для iframe по умолчанию).

Вставить в html-страницу документ Microsoft Word можно следующей строкой:

<iframe src="document.doc" width=200 height=500>

По аналогии можно вставить в html-страницу документ Microsoft Excel:

<iframe src="table.xls" width=200 height=500>

Это может быть полезно, например, если на страницах нужно выложить часто обновляемые прайсы, а переводить их в html-вид затруднительно.

Однако, на мой взгляд, перебарщивать с этим не стоит, т.к. обычно файлы офиса достаточно много «весят», а это для многих пользователей может быть решающим фактором.

Кроме того, данная конструкция у большинства пользователей без дополнительных настроек браузеров (IE, FF, Opera, Safari)работать не будет. Фрейм останется пустым (Safari), или будет предложено сохранить файл на диск или открыть в Word/Excel (IE, FF, Opera).

Самый простой способ — сохранить исходный файл Word/Excel с помощью команды: File -> Save as WEB… (Файл -> Сохранить как веб-страницу…) и полученный файл html уже вставлять в iframe.


Download Article


Download Article

This wikiHow teaches you how to embed a Word document in your website. On Google Sites, you can embed an image of the Word document directly into the page, while WordPress and self-hosted sites will require you to upload the Word document and then place a link to it in your webpage’s text.

  1. Image titled Put a Word Document on Your Website Step 1

    1

    Open Google Drive. Go to https://drive.google.com/ in your web browser. This will open your Google account’s Drive contents if you’re logged in.

    • If you aren’t logged in, enter your email address and password first.
    • You may need to click Go to Google Drive before proceeding.
  2. Image titled Put a Word Document on Your Website Step 2

    2

    Click NEW. It’s a blue button in the upper-left corner of the page. A drop-down menu will appear.

    Advertisement

  3. Image titled Put a Word Document on Your Website Step 3

    3

    Click File upload. This is in the drop-down menu. Doing so will open a window.

  4. Image titled Put a Word Document on Your Website Step 4

    4

    Select your Word file. Double-click the Word file that you want to embed on your website. This will prompt it to upload into Google Drive.

    • It shouldn’t take more than a few seconds for most Word documents to upload to Drive.
  5. Image titled Put a Word Document on Your Website Step 5

    5

    Open Google Sites. Go to https://sites.google.com/new in your web browser.

    • If you aren’t logged into your Google account when you do this, you’ll be prompted to enter your email address and password before continuing.
  6. Image titled Put a Word Document on Your Website Step 6

    6

    Select your Google Site. Click on the Google Site on which you want to insert the Word document.

  7. Image titled Put a Word Document on Your Website Step 7

    7

    Go to the page that you want to use. Scroll down until you arrive on the page on which you want to insert the Word document.

  8. Image titled Put a Word Document on Your Website Step 8

    8

    Click the INSERT tab. It’s in the upper-left side of the Google Sites window.

  9. Image titled Put a Word Document on Your Website Step 9

    9

    Click From Drive. This option is below the «Google Drive» heading near the top of the page.

  10. Image titled Put a Word Document on Your Website Step 10

    10

    Select the document. In the right-hand column, click the document that you want to insert.

  11. Image titled Put a Word Document on Your Website Step 11

    11

    Click INSERT. It’s in the lower-right corner of the page. This will place the Word document on your website.

  12. Image titled Put a Word Document on Your Website Step 12

    12

    Resize the document. Click and drag the top or bottom of the document to adjust its vertical size, or click and drag one of its sides to adjust the overall size of the document on your site.

  13. Image titled Put a Word Document on Your Website Step 13

    13

    Click PUBLISH. It’s the purple button in the top-right corner of the page. This will update your website with your uploaded document; you should now be able to see your Word document embedded in your Google Site.

  14. Advertisement

  1. Image titled Put a Word Document on Your Website Step 14

    1

    Open WordPress. Go to https://wordpress.com/ in your web browser. While you can’t embed an image of your document on a WordPress domain, you can embed a link that downloads the WordPress file when clicked.

    • If you aren’t logged into your WordPress account, first click Log In in the top-right corner of the page, then enter your email address and password.
  2. Image titled Put a Word Document on Your Website Step 15

    2

    Click My Site. It’s in the upper-left corner of the WordPress page. Doing so will load your site’s page.

  3. Image titled Put a Word Document on Your Website Step 16

    3

    Click View Site. This option is in the upper-left side of the page.

  4. Image titled Put a Word Document on Your Website Step 17

    4

    Click Visit Site. It’s in the upper-right side of the page. This will take you to your site.

  5. Image titled Put a Word Document on Your Website Step 18

    5

    Go to the page that you want to use. Click the tab for the page on which you want to insert your Word document link; you’ll usually find these tabs at the top of the page.

  6. Image titled Put a Word Document on Your Website Step 19

    6

    Click Edit. You’ll find this option in the bottom-right side of the page.

  7. Image titled Put a Word Document on Your Website Step 20

    7

    Choose a place for your link. Click on the page the place in which you want to insert a link for your Word document.

  8. Image titled Put a Word Document on Your Website Step 21

    8

    Click + Add. This is a button on the left side of the page. A pop-up menu will appear.

  9. Image titled Put a Word Document on Your Website Step 22

    9

    Click Media. It’s an option near the top of the pop-up menu. Doing so opens a page with all of your website’s stored media.

  10. Image titled Put a Word Document on Your Website Step 23

    10

    Click Add New. This is in the upper-left side of the page that opens.

  11. Image titled Put a Word Document on Your Website Step 24

    11

    Select a Word document. Click the Word document that you want to use on your site, then click Open in the bottom-right corner of the window. This will upload the Word document to the storage section of WordPress.

  12. Image titled Put a Word Document on Your Website Step 25

    12

    Select the uploaded document. Click the Word document to do so.

  13. Image titled Put a Word Document on Your Website Step 26

    13

    Click Insert. It’s in the bottom-right side of the window. This will insert a link to your Word document.

  14. Image titled Put a Word Document on Your Website Step 27

    14

    Change the link text. If you want the link text to say something other than the Word document’s name, select the link once, click the pencil-shaped icon next to the link that appears, change the text in the «Link Text» field, and click Save.

  15. Image titled Put a Word Document on Your Website Step 28

    15

    Click Update. It’s a blue button in the top-right corner of the page. This will update your website with your uploaded document, allowing you to click the embedded link to download the Word document.

  16. Advertisement

  1. Image titled Put a Word Document on Your Website Step 29

    1

    Upload the Word document to your website’s root folder. When hosting your own website, you should have a folder that contains the resources (e.g., pictures) that appear on your website. You’ll need to place your Microsoft Word document in this folder.

    • This step will depend heavily upon the software that you use to host your website.
  2. Image titled Put a Word Document on Your Website Step 30

    2

    Copy the Word document’s address. Again, this step will depend on the software that you use to host your website, but you can usually find the address in a URL bar at the top of the page. Click and drag your mouse across the address to select it, then press Ctrl+C (Windows) or Command+C (Mac).

  3. Image titled Put a Word Document on Your Website Step 31

    3

    Open your website’s code document. Open the text or HTML document in which your website’s code is stored.

  4. Image titled Put a Word Document on Your Website Step 32

    4

    Select a place for the link. Find the place in which you want to insert the link for your Word document, then click that place.

  5. Image titled Put a Word Document on Your Website Step 33

    5

    Create the HREF tag. Type in <a href= into your text editor.

  6. Image titled Put a Word Document on Your Website Step 34

    6

    Paste in the Word document’s address. Press Ctrl+V (Windows) or Command+V (Mac).

  7. Image titled Put a Word Document on Your Website Step 35

    7

    Close the HREF tag. Type in > to close the tag. You should now have a line of text that reads<a href=link> here.

  8. Image titled Put a Word Document on Your Website Step 36

    8

    Enter the link text. Type in the text that you want to use as the link on which someone clicks. You’ll do this immediately after the closed HREF tag.

    • For example, if you want people to click on a link that says «click here», you’d have <a href=link>click here written.
  9. Image titled Put a Word Document on Your Website Step 37

    9

    Add the closed link tag. On the right side of the link text that you want to use, type in </a> and press Enter. This completes the link.

    • Your line of text should now look like this: <a href=link>click here</a>
  10. Image titled Put a Word Document on Your Website Step 38

    10

    Refresh your website. Once the website’s code is updated, you should be able to click the link that you just introduced to download the Word document.

  11. Advertisement

Add New Question

  • Question

    Can I have my website open a word document in a separate tab?

    Community Answer

    Try putting target=»_blank» as one of the attributes in your tag if you have one.

  • Question

    How do I attach a medical certificate to a form?

    Community Answer

    It depends. If the form is online and has an «attach» option, you can scan a copy of the medical certificate and attach the file there. If the form is being submitted via email, you can attach a copy of the certificate like you would any other attachment. If the form is being submitted in person or by mail, you can just use a paperclip to attach the certificate to the form.

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

About This Article

Thanks to all authors for creating a page that has been read 216,089 times.

Is this article up to date?

Материал из Справочник Web-языков

Перейти к: навигация, поиск

Вставить документы Оффиса можно при помощи плавающего фрейма <IFRAME>. Для этого достаточно указать только адрес вставляемого документа и размеры фрейма. Если размеры фрейма не указывать, то размер на странице будет: width — 300 пикселов, height — 150 пикселов (это значение для iframe по умолчанию).

Вставить в html-страницу документ Microsoft Word можно следующей строкой:

<iframe src="document.doc" width=200 height=500>

По аналогии можно вставить в html-страницу документ Microsoft Excel:

<iframe src="table.xls" width=200 height=500>

Это может быть полезно, например, если на страницах нужно выложить часто обновляемые прайсы, а переводить их в html-вид затруднительно.

Однако, на мой взгляд, перебарщивать с этим не стоит, т.к. обычно файлы офиса достаточно много «весят», а это для многих пользователей может быть решающим фактором.

Кроме того, данная конструкция у большинства пользователей без дополнительных настроек браузеров (IE, FF, Opera, Safari)работать не будет. Фрейм останется пустым (Safari), или будет предложено сохранить файл на диск или открыть в Word/Excel (IE, FF, Opera).

Самый простой способ — сохранить исходный файл Word/Excel с помощью команды:
File -> Save as WEB… (Файл -> Сохранить как веб-страницу…) и полученный файл html уже вставлять в iframe.


Загрузить PDF


Загрузить PDF

Из этой статьи вы узнаете, как разместить документ Word на своем сайте. На Google Сайтах изображение документа Word можно добавить непосредственно на страницу, а в случае сайта на WordPress или размещенного сайта документ Word нужно загрузить, а затем создать на него ссылку в тексте веб-страницы.

  1. Изображение с названием Put a Word Document on Your Website Step 1

    1

    Откройте Google Диск. Перейдите на страницу https://drive.google.com/ в веб-браузере. Откроется содержимое вашего аккаунта Google, если вы уже авторизовались.

    • Если вы еще не вошли в свой аккаунт, сначала введите адрес электронной почты и пароль.
    • Возможно, сначала придется нажать «Перейти на Google Диск».
  2. Изображение с названием Put a Word Document on Your Website Step 2

    2

    Щелкните по Создать. Это синяя кнопка в верхнем левом углу страницы. Откроется меню.

  3. Изображение с названием Put a Word Document on Your Website Step 3

    3

    Нажмите Загрузить файл. Эта опция находится в меню. Откроется окно.

  4. Изображение с названием Put a Word Document on Your Website Step 4

    4

    Выберите документ Word. Дважды щелкните по нужному документу Word. Он загрузится в Google Диск.

    • На загрузку документа Word уйдет не более нескольких секунд.
  5. Изображение с названием Put a Word Document on Your Website Step 5

    5

    Откройте Google Сайты. Перейдите на страницу https://sites.google.com/new в веб-браузере.

    • Если вы еще не вошли в свою учетную запись Google, введите адрес электронной почты и пароль.
  6. Изображение с названием Put a Word Document on Your Website Step 6

    6

    Выберите сайт. Нажмите на сайт, на котором вы хотите разместить документ Word.

  7. Изображение с названием Put a Word Document on Your Website Step 7

    7

    Перейдите на нужную страницу. Прокрутите вниз, чтобы найти страницу, на которой хотите разместить документ Word.

  8. Изображение с названием Put a Word Document on Your Website Step 8

    8

    Щелкните по вкладке Вставка. Она находится в верхней правой части окна.

  9. Изображение с названием Put a Word Document on Your Website Step 9

    9

    Нажмите Объект на Диске. Эта опция находится в верхней правой части страницы.

  10. Изображение с названием Put a Word Document on Your Website Step 10

    10

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

  11. Изображение с названием Put a Word Document on Your Website Step 11

    11

    Щелкните по Вставить. Эта кнопка находится в правом нижнем углу страницы. Документ Word будет размещен на вашем сайте.

  12. Изображение с названием Put a Word Document on Your Website Step 12

    12

    Измените размеры документа. Нажмите и перетащите верхнюю или нижнюю границу документа, чтобы изменить размер по вертикали, или нажмите и перетащите одну из боковых границ, чтобы изменить общий размер документа.

  13. Изображение с названием Put a Word Document on Your Website Step 13

    13

    Нажмите Опубликовать. Это пурпурная кнопка в правом верхнем углу страницы. Сайт будет обновлен и на нем появится документ Word.

    Реклама

  1. Изображение с названием Put a Word Document on Your Website Step 14

    1

    Откройте WordPress. Перейдите на страницу https://ru.wordpress.com/ в веб-браузере. Изображение документа нельзя добавить на сайт под управлением WordPress, но можно вставить ссылку, которая приведет к загрузке документа, если нажать на нее.

    • Если вы еще не вошли в свою учетную запись WordPress, нажмите «Войти» в верхнем правом углу страницы, а затем введите адрес электронной почты и пароль.
  2. Изображение с названием Put a Word Document on Your Website Step 15

    2

    Щелкните по Мой сайт. Эта опция находится в верхнем левом углу страницы WordPress. Откроется страница вашего сайта.

  3. Изображение с названием Put a Word Document on Your Website Step 16

    3

    Нажмите Просмотреть сайт. Эта опция находится в верхней левой части страницы.

  4. Изображение с названием Put a Word Document on Your Website Step 17

    4

    Щелкните по Перейти на сайт. Эта опция находится в верхней правой части страницы. Вы перейдете на свой сайт.

  5. Изображение с названием Put a Word Document on Your Website Step 18

    5

    Перейдите на нужную страницу. Щелкните по вкладке страницы, на которой вы хотите вставить ссылку на документ Word; такие вкладки расположены в верхней части страницы.

  6. Изображение с названием Put a Word Document on Your Website Step 19

    6

    Нажмите Редактировать. Вы найдете эту опцию в нижней правой части страницы.

  7. Изображение с названием Put a Word Document on Your Website Step 20

    7

    Выберите место для ссылки. На странице нажмите там, где будет находиться ссылка на документ Word.

  8. Изображение с названием Put a Word Document on Your Website Step 21

    8

    Щелкните по + Добавить. Это кнопка в левой части страницы. Откроется меню.

  9. Изображение с названием Put a Word Document on Your Website Step 22

    9

    Нажмите Медиа. Это опция в верхней части меню. Откроется страница со всеми хранимыми медиафайлами вашего веб-сайта.

  10. Изображение с названием Put a Word Document on Your Website Step 23

    10

    Щелкните по Добавить новый. Эта опция находится в верхней левой части открывшейся страницы.

  11. Изображение с названием Put a Word Document on Your Website Step 24

    11

    Выберите документ Word. Нажмите на нужный документ Word, а затем щелкните по «Открыть» в нижнем правом углу окна. Документ Word загрузится в хранилище WordPress.

  12. Изображение с названием Put a Word Document on Your Website Step 25

    12

    Выберите загруженный документ. Для этого нажмите на него.

  13. Изображение с названием Put a Word Document on Your Website Step 26

    13

    Щелкните по Вставить. Эта опция находится в нижней правой части окна. Будет добавлена ссылка на документ Word.

  14. Изображение с названием Put a Word Document on Your Website Step 27

    14

    Измените текст ссылки. По умолчанию текстом ссылки является имя документа; чтобы изменить текст ссылки, выберите ссылку, щелкните по значку в виде карандаша у ссылки, измените текст в поле «Текст ссылки» и нажмите «Сохранить».

  15. Изображение с названием Put a Word Document on Your Website Step 28

    15

    Щелкните по Обновить. Это голубая кнопка в правом верхнем углу страницы. Сайт будет обновлен и на нем появится ссылка — щелкните по ней, чтобы скачать документ Word.

    Реклама

  1. Изображение с названием Put a Word Document on Your Website Step 29

    1

    Загрузите документ Word в корневую папку своего веб-сайта. В случае размещения своего веб-сайта существует папка, в которой хранятся элементы (например, изображения), отображающиеся на сайте. Загрузите документ Microsoft Word в эту папку.

    • Этот шаг зависит от программного обеспечения, которое вы используете для размещения своего веб-сайта.
  2. Изображение с названием Put a Word Document on Your Website Step 30

    2

    Скопируйте адрес документа Word. Опять же, этот шаг зависит от программного обеспечения, которое вы используете для размещения своего сайта, но, как правило, адрес отображается в адресной строке в верхней части страницы. Нажмите и перетащите указатель мыши по адресу, чтобы выбрать его, а затем нажмите Ctrl+C (Windows) или Command+C (Mac).

  3. Изображение с названием Put a Word Document on Your Website Step 31

    3

    Откройте код своего веб-сайта. Откройте текстовый или HTML-документ, в котором хранится код веб-сайта.

  4. Изображение с названием Put a Word Document on Your Website Step 32

    4

    Выберите место для ссылки. Щелкните там, где будет находится ссылка на документ.

  5. Изображение с названием Put a Word Document on Your Website Step 33

    5

    Создайте тег HREF. Введите <a href= в текстовом редакторе.

  6. Изображение с названием Put a Word Document on Your Website Step 34

    6

    Вставьте адрес документа Word. Нажмите Ctrl+V (Windows) или Command+V (Mac).

  7. Изображение с названием Put a Word Document on Your Website Step 35

    7

    Закройте тег HREF. Для этого введите >. Должна получиться строка <a href=адрес>.

  8. Изображение с названием Put a Word Document on Your Website Step 36

    8

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

    • Например, если вы хотите, чтобы люди нажимали на ссылку «Нажмите здесь», должна получиться строка <a href=адрес>Нажмите здесь.
  9. Изображение с названием Put a Word Document on Your Website Step 37

    9

    Добавьте закрывающий тег ссылки. Справа от текста ссылки введите </a> и нажмите Enter. Ссылка готова.

    • Строка должна выглядеть следующим образом: <a href=адрес>Нажмите здесь</a>
  10. Изображение с названием Put a Word Document on Your Website Step 38

    10

    Обновите сайт. Теперь щелкните по добавленной ссылке, чтобы скачать документ Word.

    Реклама

Об этой статье

Эту страницу просматривали 22 288 раз.

Была ли эта статья полезной?

No browsers currently have the code necessary to render Word Documents, and as far as I know, there are no client-side libraries that currently exist for rendering them either.

However, if you only need to display the Word Document, but don’t need to edit it, you can use Google Documents’ Viewer via an <iframe> to display a remotely hosted .doc/.docx.

<iframe src="https://docs.google.com/gview?url=http://remote.url.tld/path/to/document.doc&embedded=true"></iframe>

Solution adapted from «How to display a word document using fancybox».

Example:

JSFiddle

However, if you’d rather have native support, in most, if not all browsers, I’d recommend resaving the .doc/.docx as a PDF file Those can also be independently rendered using PDF.js by Mozilla.

Edit:

Huge thanks to cubeguerrero for posting the Microsoft Office 365 viewer in the comments.

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http://remote.url.tld/path/to/document.doc' width='1366px' height='623px' frameborder='0'>This is an embedded <a target='_blank' href='http://office.com'>Microsoft Office</a> document, powered by <a target='_blank' href='http://office.com/webapps'>Office Online</a>.</iframe>

One more important caveat to keep in mind, as pointed out by lightswitch05, is that this will upload your document to a third-party server. If this is unacceptable, then this method of display isn’t the proper course of action.

Live Examples:

Google Docs Viewer

Microsoft Office Viewer

Понравилась статья? Поделить с друзьями:
  • Html верстка для word
  • Html from word document
  • Html в текстовом редакторе word
  • Html word wrap white space
  • Html word wrap text box