Styleref word что это

Обновлено: 06.07.2024

Спустя год после публикации заметки Как автоматически вставить подпись к рисунку или таблице, предлагаю вашему вниманию альтернативный (в какой-то мере) совет от читательницы Ирины. Возможно это решение кому-то пригодится.

Нумерацию таблиц, рисунков и формул я провожу с помощью команды "Название" (меню Вставка-Ссылка), выбираю соответствующее значение в выпадающем списке "Подпись" и устанавливаю флажок на параметре "Исключить подпись из названия". Опцию "Автоназвание" я не использую.

Рисунки и таблицы
Слова "рисунок" или "таблица" пишу руками, точнее создала макрос для вставки рисунков и таблиц. С помощью клавиши «Enter» переношу номер рисунка или таблицы на следующую строку (в строке оказывается только номер), затем в нужном месте с помощью команды "Перекрестная ссылка" (меню Вставка-Ссылка) ссылаюсь на него (вставляется только номер, а слова "рисунок" или "таблица" пишу самостоятельно в нужном падеже).
Перехожу обратно к рисунку и возвращаю номер на свое место.
Если нужно сослаться несколько раз на один и тот же рисунок или таблицу, то повторяю операцию, либо копирую уже сделанную ссылку. Таким образом, ссылки соответствуют ГОСТу и проблем с обновлением полей не возникает.

Формулы
Формулы я вставляю в таблицу с невидимыми границами с одной строкой и двумя столбцами. Делаю это с помощью макроса и в итоге получаю таблицу, в первом столбце которой по центру стоит запятая, а во втором - по центру находятся круглые скобки. В первый столбец заношу формулу, во второй с помощью команды "Название" ее номер. Ссылаюсь на формулу с помощью команды "Перекрестная ссылка" и получаю при этом номер формулы в круглых скобках (ячейка таблицы воспринимается программой как новая строка).

Если у кого-то есть вопросы к Ирине по предложенному способу, задавайте в комментариях.

Вы можете помочь в развитии сайта, сделав пожертвование:

--> Или помочь сайту популярной криптовалютой:

BTC Адрес: 1Pi3a4c6sJPbfF2sSYR2noy61DMBkncSTQ

ETH Адрес: 0x7d046a6eaa1bd712f7a6937b042e9eee4998f634

LTC Адрес: LUyT9HtGjtDyLDyEbLJZ8WZWGYUr537qbZ

USDT (ERC-20) Адрес: 0x7d046a6eaa1bd712f7a6937b042e9eee4998f634

Яндекс Деньги: 410013576807538

А тут весь список наших разных крипто адресов, может какой добрый человек пожертвует немного монет или токенов - получит плюсик в карму от нас :) Благо Дарим, за любую помощь! -->

Сегодня я хочу рассказать об одном из способов автоматизации документов, в частности, об автообновлении колонтитулов. Речь идет об использовании в колонтитулах поля StyleRef . Кстати, ранее я уже писал заметку на эту тему - Как вставить название главы в колонтитул.

Итак, предположим, что вы создаете документ, состоящий из нескольких именованных глав. Каждая глава начинается с нового раздела. Текст в колонтитуле (обычно верхний) каждого раздела должен автоматически меняться в зависимости от наименования главы раздела. Как это реализовать?

Теперь вы можете видеть, что в колонтитулах каждого вашего раздела содержится текст с наименованиями глав разделов. А при изменении наименования главы вы можете наблюдать синхронное изменение текста в колонтитуле.

Конечно, самое правильное, это добавить поле StyleRef не в конечный документ, а в шаблон, на основе которого вы создаете свои документы. В этом случае вам достаточно лишь добавлять наименования глав, чтобы они автоматически отображались в колонтитулах.

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

Например, находясь в колонтитуле, нажмите сочетание клавиш «Ctrl»+«F9». В строке ввода появятся метки в виде фигурных скобках и мигающим внутри них курсором ввода. Введите между скобок следующию инструкцию: StyleRef "Заголовок 1" .

При обновлении поля эта инструкция заменится на соответствующий текст.

Вы можете помочь в развитии сайта, сделав пожертвование:

--> Или помочь сайту популярной криптовалютой:

BTC Адрес: 1Pi3a4c6sJPbfF2sSYR2noy61DMBkncSTQ

ETH Адрес: 0x7d046a6eaa1bd712f7a6937b042e9eee4998f634

LTC Адрес: LUyT9HtGjtDyLDyEbLJZ8WZWGYUr537qbZ

USDT (ERC-20) Адрес: 0x7d046a6eaa1bd712f7a6937b042e9eee4998f634

Яндекс Деньги: 410013576807538

А тут весь список наших разных крипто адресов, может какой добрый человек пожертвует немного монет или токенов - получит плюсик в карму от нас :) Благо Дарим, за любую помощь! -->

Что нужно:
Код поля, который бы при наличии в документе текста стиля "Название", показывал "Yes" в поле.
При отсутствии - показывал "No".

Пробовал по разному:

при отсутствии текста со стилем "Название", выдает ошибку
те, что ниже - не работают

2 Ответ от admin 16.01.2010 16:24:41

Уточняющий вопрос: с какой целью или для чего нужет такой код? Может быть проще закрыть шаблон (точнее стили шаблона) от изменения? Тогда в документе будут только те стили, которые есть в шаблоне и новые не смогут быть внедрены или же старые не смогут быть удалены.

3 Ответ от viter.alex 16.01.2010 22:41:12

Можно, конечно
< IF < QUOTE < STYLEREF "Название объекта" >> = "Ошибка! Текст указанного стиля в документе отсутствует." "No" "Yes" >

4 Ответ от rizalut 17.01.2010 14:51:00

viter.alex

Громадное спасибо!
Я перебрал все найденные в енете операторы формул, а вот решение с текстом ошибки мне даже в голову не пришло.

admin
Хочу сделать универсальный колонтитул.
Название | Заголовок_раздела

На первой странице раздела он не будет показывать название раздела.
Если Название или Заголовок_раздела отсутствуют, то не будет их показывать.

А стили по любому мне придется защищать.
Обнаружил недокументированный способ защиты стиля. Если поместить в ContentControl текст, отформатированный этим стилем, задать СС защиту от изменения, то стиль изменить невозможно

5 Ответ от rizalut 17.01.2010 17:31:56

viter.alex

А как определить, что один из 2-х стилей в тексте отсутствует?
Сделать типа такое (оставил только первые буквы операторов для читабельности):

Т.е. конструкцию по типу If "Ошибка1" Or "Ошибка2" Then.

То что я попробовал ниже - не работает

6 Ответ от rizalut 17.01.2010 19:43:12

Вот 2 варианта кода, оба не работают. Не могу понять, что неправильно?

< IF < =OR(< COMPARE < STYLEREF “Название” >= "Ошибка! Текст указанного стиля в документе отсутствует." >, < COMPARE < STYLEREF “Заголовок 1” >= "Ошибка! Текст указанного стиля в документе отсутствует.")> "No" "Yes" >

< IF < =OR(< QUOTE < STYLEREF “Название” >> = "Ошибка! Текст указанного стиля в документе отсутствует." >, < QUOTE < STYLEREF “Заголовок 1” >> = "Ошибка! Текст указанного стиля в документе отсутствует.")> "No" "Yes" >

7 Ответ от viter.alex 17.01.2010 20:05:54

Логические операции можно заменить на арифметические. Это полезно, если используется много условий. У меня получилось вот так:
< IF < = SUM(< IF < QUOTE < STYLEREF "Название объекта" >> = "Ошибка! Текст указанного стиля в документе отсутствует." 0 1>; < IF < QUOTE < STYLEREF "Заголовок 1" >> = "Ошибка! Текст указанного стиля в документе
отсутствует." 0 1 >) > = 0 "Стили неопределены" "Один из стилей определён">

8 Ответ от rizalut 17.01.2010 20:50:43

viter.alex, спасибо, вы всегда предлагаете не очевидные для меня решения. Тем они ценней.

Вылез новый момент.
Если указанным стилем отформатирован текст в ContentControl, то в поле виден не "текст СС" а "<текст СС>", т.е. он обрамлен символами стрелок. Есть ли возможность показать его без обрамляющих "<" и ">" ? Как это можно реализовать?

Отредактировано rizalut (17.01.2010 20:54:48)

9 Ответ от rizalut 20.01.2010 09:10:21

Похожие темы

при отсутствии названия выдает ошибку

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

Форум Ворд Эксперт предназначен для продвинутых пользователей, дорожащих своим временем и желающих совершенствоваться. Наш сайт о Microsoft Office Word даст ответ про: импорт эксель в ворд. Здесь вы найдете информацию по самым тонким настройкам программы, макросам и шаблонам.

У форума удобная структура, позволяющая быстро найти любую интересующую информацию. Наш сайт о Microsoft Office Word даст ответ про: вставка из буфера текста. Самое основное вынесено в «Часто задаваемые вопросы», более нетривиальные проблемы настроек различных функций, редактирования, форматирования и оформления обсуждаются в подразделе «Настройки и Форматирования», а написанию шаблонов и макросов посвящен раздел «Автоматизация». Наш сайт о Microsoft Office Word даст ответ про: экспорт из экселя в ворд.

Со своими проблемами вы можете обратиться в подраздел форума «Заявки на разработку», но возможно вам помогут готовые решения из одноименного раздела. На портале о Microsoft Office Word вы узнаете про: word заголовок колонтитуле. Для общения администрацией форума выделена «Курилка».

Кроме того, на форуме приведен список литературы очень полезной для освоения программы и оптимизации работы с Вордом. Наш сайт о Microsoft Office Word даст ответ про: как изменить первоначальный шрифт в excel 2010.

We have a document that is causing issues with the Word application, causing it to enter the Not Responding state almost immediately after opening it.

The cursor turns into the rotating circle - processing - and stays like that. If we try to scroll through the document, that is when issues start occurring and Word stops responding.

Apparently, desktop computers can open the file, but laptops struggle.

I have narrowed the issue to the use of StyleRef in the header.

If I delete the StyleRef field, then the document functions perfectly.

I don't know much about StyleRef, but it appears to be taking the current document heading and placing it in the Header. I would not have though this would have been too resource intensive, but it seems to be doing something weird.

The Headings do not contain anything strange. Just a couple of words in each one.

The rotating circle seems to indicate that it is perhaps getting into an update loop with the StyleRef fields or something?

Any ideas what I should be looking at? I can just delete the StyleRef field, though the owner would like to use it, if possible.

The document is 142 pages long. It contains a combination of text, tables and pictures.

Word version is 2012 (Build 13530.20528 Click-to-Run)

Windows version is 20H2 (Build 19042.804)

This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Hi Anthony,

May I know if the workaround shared by Charles Kenyon worked on your side for a bit?

If the issue persists, please message me back in the private message link. We will do a test in the same version 2012(Build 13530.20528) as yours.

I'm not sure which workaround Charles posted. If it was to use the Web App, then yes, it does allow us to open and work on the file.

However, the user does not like the Web Interface, and does have the functionality they need from the Desktop App.

We are using another workaround where we have a Terminal Server set up with a Shared Computer license. That opens the file without issue.

That is running Version 2012 (Build 13530.20528)

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Anthony, if it's convenient for you, could you change your update channel to Current and see if it resolve the issue?

Can you let me know how to change to the Current channel?

We are currently on the Monthly Enterprise Channel.

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Hi Alex,

Can you let me know how to change to the Current channel?

We are currently on the Monthly Enterprise Channel.

Thanks,

Anthony

I found a command line that apparently lets me do this, but as I'm at the latest version, it is still showing up as Monthly Enterprise.

From what I have read, this only updates once an update has been installed.

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Hi Anthony,

May I know if the workaround shared by Charles Kenyon worked on your side for a bit?

If the issue persists, please message me back in the private message link. We will do a test in the same version 2012(Build 13530.20528) as yours.

I'm not sure which workaround Charles posted. If it was to use the Web App, then yes, it does allow us to open and work on the file.

However, the user does not like the Web Interface, and does have the functionality they need from the Desktop App.

We are using another workaround where we have a Terminal Server set up with a Shared Computer license. That opens the file without issue.

That is running Version 2012 (Build 13530.20528)

The workaround is to add spaces in the header after the StyleRef field. (not the Web interface)

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

1 person found this reply helpful

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

The workaround is to add spaces in the header after the StyleRef field. (not the Web interface)

Sorry, my interpretation of that statement was it was a workaround for the concatenation of the Header field while within the Web App.

I have tried it in my desktop version of the document, and it does not fix the problem.

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

As you are an Office 365 Business user, I think your update channel should be controlled by your IT department.

Could you reach to the IT admin for help switching the update channel?

To switch update channel, there are majorly 2 methods.

1.Control the update channel through the Group Policy.

2.Uninstall the current version and deploy the current channel version via ODT.

Report abuse

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

1 person found this reply helpful

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Hi All,

I can confirm I am seeing the similar issue on my side.

With the Word version 2012 (Build 13530.20528 Click-to-Run) Monthly Update Channel, when scroll the document with multiple headings and Styleref field in the header. The cursor is constantly changing to the blue circle loading icon. And the CPU consumption will be really high. Anyway, it does not crash the Word app. I think the reason is my document is relatively small, only 16 pages and 9 headings.

However, when I switch to the Current Update Channel Version 2012 (Bulid 13801.20266), the issue disappear, although the CPU consumption will still be higher comparing with the no-styleref. It doesn't change the cursor icon to the loading icon.

Anthony, if it's convenient for you, could you change your update channel to Current and see if it resolve the issue?

Regards,

Alex Chen

Tomorrow is the second Tuesday of the month. Can you confirm that the fix, which apparently is available in the current channel, will also be available in the Monthly Enterprise Channel?

Читайте также: