Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2022, 04:41 AM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default Une propriété des styles

Bonjour
Ma question concerne une propriété des styles.
Je crée un style de paragraphe, nommé Style1.
Je tape quelques lettres avec ce style, je les sélectionne puis en utilisant la boîte de dialogue "Bordure et Trame ..", "Trame de fond" de l'onglet Paragraphe, je colorie le fond en rouge, en appliquant ceci à "Texte".
Puis j'ouvre la fenetre Styles (Alt + Ctrl+Maj+S), je sélectionne le Style1 et je clique sur "Mettre à jour Style1 pour correspondre à la sélection".
Désormais, quand je tape du texte en Style1, il apparait sur fond rouge.
Mon problème, c'est que je ne suis pas fichu de trouver quelle est la propriété correspondante du style, dans la fenêre "Modifier ...", histoire d'aller plus vite ....
En vba, ce qui suit fonctionne dans le module ThisDocument



Code:
Me.Styles("Style1" ).Font.Shading.BackgroundPatternColor = RGB(255, 0, 0)
mais on doit pouvoir le faire directement et simplement, je ne vois pas comment !


Traduction automatique
My question is about a property of styles. I create a paragraph style, named Style1. I type a few letters with this style, select them then using the "Border and Shading.." dialog box, "Shading" from the Paragraph tab, color the background red, applying this to "Text ". Then I open the Styles window (Alt+Ctrl+Shift+S), select Style1 and click "Update Style1 to match selection". Now, when I type text in Style1, it appears on a red background.

My problem is that I can't find what the corresponding property of the style is, in the "Edit..." window, just to go faster....

In vba the following works in the ThisDocument module

Code:
Me.Styles("Style1").Font.Shading.BackgroundPatternColor = RGB(255, 0, 0)
but we must be able to do it directly and simply, I don't see how!
Reply With Quote
  #2  
Old 06-12-2022, 11:20 AM
Charles Kenyon Charles Kenyon is online now Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Do you mean Modify Style dialog? (English version)
There should be a button for formatting with a dropdown. It will have choices that include Font (where you can color the font) and one for Borders and Shading.
Modify a Style by Suzanne Barnhill, MVP
Reply With Quote
  #3  
Old 06-12-2022, 01:56 PM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Bonjour
Voici ma démarche :
J'ouvre la fenêtre "Styles" (Alt + Ctrl + Maj + S)
En cliquant sur l'icône en bas à gauche, j'ouvre la fenêtre "Créer un nouveau style" où je crée un nouveau style basé sur Normal. Ce nouveau style se nomme Style1.
Je clique alors sur le bouton "Format", puis sur "Bordures ..."
Je clique sur l'onglet "Trame de fond".
Dans la liste "Remplissage", je choisis la couleur rouge.
Le problème apparait dans la liste "Appliquer à" : le seul choix est "Paragraphe", l'option "Texte" n'est pas disponible.
Pour obtenir la trame de fond sur le texte seul (et pas de la marge gauche à la marge droite), je n'ai trouvé que les deux méthodes décrites dans mon premier message :
1. Utiliser une macro VBA
ou
2. Mettre à jour Style1 (déjà créé) pour correspondre à la sélection.

Est-il possible possible d'obtenir ceci directement à la création de Style1 , sans avoir à le modifier après sa création ?


Google Translate:
Hello



Here is my approach:



I open the "Styles" window (Alt + Ctrl + Shift + S) By clicking on the icon at the bottom left, I open the "Create a new style" window where I create a new style based on Normal. This new style is called Style1. I then click on the "Format" button, then on "Borders..."

I click on the "Background" tab. In the "Fill" list, I choose the color red. The problem appears in the "Apply to" list: the only choice is "Paragraph", the "Text" option is not available.

To get the shading on the text alone (and not from the left margin to the right margin), I only found the two methods described in my first post:

1. Use a VBA macro Where

2. Update Style1 (already created) to match the selection. Is it possible to get this directly when creating Style1 , without having to modify it after it's created?

Last edited by Charles Kenyon; 06-13-2022 at 11:02 AM. Reason: translation added
Reply With Quote
  #4  
Old 06-13-2022, 11:03 AM
Charles Kenyon Charles Kenyon is online now Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

To have something apply to text only, you need a character style, not a paragraph style.
Reply With Quote
  #5  
Old 06-13-2022, 11:41 AM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Merci pour vos réponses.
Toutefois, si j'utilise la méthode décrite dans mon premier message (Mettre à jour Style1 pour correspondre à la sélection), la modification s'applique uniquement au texte tapé en Style1, et Style1 est un style de paragraphe, pas un style de caractère.
Le texte tapé en Style1 apparait bien sur un fond rouge.
Faire apparaitre du texte sur un fond coloré est donc possible pour un style de paragraphe, pas en créant ce style, mais uniquement en le modifiant pour qu'il corresponde à une sélection , ou bien en utilisant VBA.



Traduction :
Thank you for your answers.
However, if I use the method described in my first post (Update Style1 to match selection), the change only applies to text typed in Style1, and Style1 is a paragraph style, not a character style .
Text typed in Style1 appears on a red background.
Making text appear on a colored background is therefore possible for a paragraph style, not by creating this style, but only by modifying it to match a selection, or by using VBA.
Reply With Quote
  #6  
Old 06-13-2022, 12:17 PM
Charles Kenyon Charles Kenyon is online now Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You can have a character style with shading. Borders applied to text are always rectangles and close to the text.
Reply With Quote
  #7  
Old 06-13-2022, 02:26 PM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Ce que je veux faire, c'est créer un style de paragraphe "Style1" en définissant par exemple un retrait gauche, des valeurs de tabulations, et un arrière plan coloré pour les caractères.
Je ne veux pas utiliser un style de caractères.
Je parviens à mes fins en deux étapes, comme expliqué plus haut :
1. Je crée le style de paragraphe "Style1". Pendant cette création, je n'arrive pas définir un arrière plan coloré pour les caractères.
2. Quand ce style est créé, je le modifie en utilisant la fonction "Mettre à jour Style1 pour correspondre à la sélection" afin d'avoir mon arrière plan coloré.
Est-il possible de tout réaliser à l'étape 1 sans être obligé d'utiliser la fonction "Mettre à jour Style1 ..." ?


Traduction :
What I want to do is create a paragraph style "Style1" by defining for example a left indent, tab values, and a colored background for the characters.
I don't want to use a character style.
I achieve my goals in two steps, as explained above:
1. I create the paragraph style "Style1". During this creation, I cannot define a colored background for the characters.
2. When this style is created, I modify it using the "Update Style1 to match selection" function to have my background colored.
Is it possible to achieve everything in step 1 without having to use the "Update Style1..." function?
Reply With Quote
  #8  
Old 06-13-2022, 03:10 PM
Charles Kenyon Charles Kenyon is online now Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You can define it using the Format > Borders and Shading. The shading (background) applies to the paragraph, since it is a paragraph style.
Reply With Quote
  #9  
Old 06-14-2022, 12:46 AM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Si j'utilise "Format > Bordures ... " comme vous le préconisez, l'arrière plan coloré s'étend de la marge gauche à la marge droite des lignes du paragraphe. Si la dernière ligne s'arrête avant la marge droite, toute la ligne est colorée même la partie située après la marque de paragraphe.
Ce que je veux, c'est que la coloration de l'arrière plan s'arrête avant la marque de paragraphe de la dernière ligne, qu'elle ne concerne que les caractères du paragraphe et que ceci soit intégré dans mon style de paragraphe.
J'y parviens en suivant la méthode exposée plus haut dans le fil, mais existe-t-il une méthode plus simple ?
Le docx attaché montre ce que je veux obtenir.

Traduction
If I use "Format > Borders..." as you recommend, the colored background extends from the left margin to the right margin of the paragraph lines. If the last line ends before the right margin, the whole line is colored even the part after the paragraph mark.
What I want is for the background coloring to stop before the paragraph mark of the last line, for it to affect only the characters in the paragraph, and for this to be integrated into my paragraph style.
I achieve this by following the method outlined earlier in the thread, but is there an easier method?
The attached docx shows what I want to achieve.
Attached Files
File Type: docx Arrière plan.docx (21.5 KB, 7 views)
Reply With Quote
  #10  
Old 06-14-2022, 08:58 AM
Charles Kenyon Charles Kenyon is online now Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

What you are asking for does not exist in Word's styles. Shading for a paragraph style will apply to the entire paragraph from indent to indent.
You would need to apply a character style to the characters you want shaded. That can handle individual characters.


Here is my chapter on Styles.
Understanding Styles in Microsoft Word
(Through Google Translate:Comprendre les styles dans Microsoft Word)
Reply With Quote
  #11  
Old 06-14-2022, 10:11 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 315
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by jpl View Post
I achieve this by following the method outlined earlier in the thread, but is there an easier method?
No. The only other way it is possible to achieve that is by editing the xml of the style definition.
Reply With Quote
  #12  
Old 06-14-2022, 11:29 AM
jpl jpl is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Thank you both for your answers.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting styles based on Normal and List styles stameni Word 5 09-17-2021 12:07 PM
Creating buttons for individual paragraph styles on a ribbon tab - not using Quick Styles T7Training Word 11 12-22-2019 12:16 PM
Does a new set of styles in a template overwrite or remove the existing set of styles in a document? dianahbr Word 6 03-27-2018 11:12 PM
Two much blank space between names of styles in the Styles Pane PereCasanellas Word 0 10-06-2017 03:47 AM
Question about spacing between multi-level bullet styles (and other styles) SDwriter Word 0 09-26-2017 09:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft