Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

Editing subsection of text in visio via powershell

$
0
0

m wondering if this i even possible

Currently I have a script to create a visio drawing relevant portions of the text being used are:

$application = New-Object -ComObject Visio.Application
$application.visible = $false
$documents = $application.Documents
$document = $documents.Add(“Basic Diagram.vst”)
$pages = $application.ActiveDocument.Pages
$page = $pages.Item(1)    
New-Variable -Name FolderTextBox$PNumber -Value $page.DrawRectangle($x-0.5, $y-0.25,$x+0.5,$y-0.7)
    (Get-Variable -Name FolderTextBox$PNumber).value.Text = ($accountslisted | Out-String).trim()
    (Get-Variable -Name FolderTextBox$PNumber).value.CellsU("LineColor").FormulaU = "RGB(255,255,255)"
    (Get-Variable -Name FolderTextBox$PNumber).value.CellsSRC(1,3,0).FormulaU = "RGB(255,255,255)"
    (Get-Variable -Name FolderTextBox$PNumber).value.Cells("Char.Color").FormulaU = "RGB(0, 0, 0)"
    (Get-Variable -Name FolderTextBox$PNumber).value.CellsU("Char.Size").FormulaU = "3 pt" 

Please note the code above is not the full code just extracted relevant parts for the question.

A typical line of text being inputted could look like:
"R: Domain\ADGroup
M: Domain\ADGroup"

The "Char.Color" and "Char.Size" lines allow me to set colour and size of the font but what I'd really love to do is also modify the text to display like:
"R: Domain\ADGroup
M: Domain\ADGroup"

note the added bolding and underlining of the start of the lines.  everything I've read seems to show you can only affect the lines of text as a whole and not seek out a few characters within the text to modify it.  does anyone know if there is a way to do this via powershell


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>