How to add hyperlink to concrete slide inside presentation using c#?
For now I have found how to Hyperlink to a site:
TextRange.ActionSettings[Microsoft.Office.Interop.PowerPoint.PpMouseActivation.ppMouseClick].Hyperlink.Address = "http://www.google.com";
and found options to Last/First/Next
TextFrame.TextRange.ActionSettings[PpMouseActivation.ppMouseClick].Action = PpActionType.ppActionFirstSlide;
but not to slide4
If you add the setting manually in PowerPoint then ask it what the setting is, it'll tell you. For example, add a link to Slide 4 to a text box, make sure the text box is selected and run this:
Sub Thing()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
Debug.Print .ActionSettings(1).Hyperlink.Address
Debug.Print .ActionSettings(1).Hyperlink.SubAddress
End With
End Sub
The result, a blank line (no hyperlink address) and a subaddress of:
259,4,Title of slide 4
259 is the SlideID
4 is the SlideIndex
"Title of slide 4" is the title text on slide 4
I'm fairly sure the ID and Index are necessary; the title is not. For example to set a link to slide 3 in the same presentation:
Sub ThingTwo()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.ActionSettings(1).Hyperlink.Address = ""
.ActionSettings(1).Hyperlink.SubAddress = "258,3,"
End With
End Sub
Doing it in c# ... left as an exercise for the reader.
Related
I'm trying to create an expandable label that looks like the one in the picture:
I have two problems:
How do I make the label truncate the tail such that it leaves enough place for the More button/clickable text?
How do I place the More text?
Maybe, I am going about it the wrong way? Instead of playing with the number of lines, should I maybe try to calculate how much text goes into one and a half line and present it only, and then when clicking More I present the whole text?
Would appreciate any advice, thanks!
You can use this library to achieve your expected output.
https://github.com/apploft/ExpandableLabel
Specify the number of lines you want to display default.
expandableLabel.numberOfLines = 2
Set true if the label should be collapsed or false for expanded.
expandableLabel.collapsed = true
collapsedAttributedLink
Set the link name that is shown when collapsed.
expandableLabel.collapsedAttributedLink = NSAttributedString(string: "More")
expandedAttributedLink
Set the link name that is shown when expanded. It is optional and can be nil.
expandableLabel.expandedAttributedLink = NSAttributedString(string: "Less")
I am trying to use iup.text to create a textbox linked to a text file.
I want to display the text file in this textbox in real time.
local Visu = iup.text{
multiline="yes",
--rastersize="x60",
expand="yes",
readonly="yes",
--font="Times, Bold 12",
SCROLLBAR="YES",
AUTOHIDE="YES",
BGCOLOR="0 43 54",
fgcolor="255 255 255",
--maxsize="x1000",
}
function refresh_txt()
local f2 = io.open("txtfile.txt", "r")
if not f2 then
Visu.value = "Empty File"
else
Visu.value = f2:read("*a")
end
end
The problem is, when the textbox is just actualized by the function refresh_txt()` the cursor is put at the beginning of the showed text and not at the end of the text as I want.
So the text is constantly being refreshed and I can't scroll down because when I did it, the cursor goes to the first character of the first line.
I want an automatic vertical expand of the textbox when refreshed.
I think that the problem can be solved by some argument of iup.text, but I didn't found it.
To scroll down after changing the text use VisuQSPI.scrollto = "99999999:1".
I've got a UIButton, it's a simple segue to another page.
I've set Title to attributed and then selected word wrap. This works fine, the second word wraps down to the next line.
However, it is all left justified. When I select "Align Centre" (using the buttons just under the "Title", the word wrap no longer works and simply runs .... so you can't see it all. (e.g. "next pa" instead of "next page")
Am I missing something here? It seems like such a trivial thing to do! There's an old answer here can't get word wrap to work on UIButton but it's both old and uses code - surely you don't need code to centre the button text if you want to word wrap it to 2 lines!?
I've set Title to attributed and then selected word wrap. This works fine, the second word wraps down to the next line. However, it is all left justified.
Once you've decided to use an attributed string, you must do everything with the attributed string. So give your attributed string a paragraph style that centers the text.
let para = NSMutableParagraphStyle()
para.alignment = .center
para.lineBreakMode = .byWordWrapping
let s = NSAttributedString(
string: "Hello World", attributes: [.paragraphStyle : para])
self.button.setAttributedTitle(s, for: .normal)
You will also need to set the button's title label to allow multiple lines.
self.button.titleLabel?.numberOfLines = 0
Result:
surely you don't need code to centre the button text if you want to word wrap it to 2 lines!?
Not to center it, no; you can set the centering in the storyboard. So you could eliminate the first batch of code and configure it in the storyboard. But you must use code to turn the title label into a multiline label:
self.button.titleLabel?.numberOfLines = 0
There is no way to do that in the storyboard, because you have no access to the title label there.
I've just been playing round with this and I've found it works if you set it to 'character wrap' rather than 'word wrap' once you've selected centre alignment.
If anyone has a better solution please add it, as I guess this might have issues if you slightly change the width etc when using auto layout for different screen sizes etc if you want it to adapt its width so this might not be the best solution but it does work
I add a context menu item for new mail of Outlook, after select any text, use below method to add the Hyperlink. This works well in most conditions, but the hyperlink does not display with blue and underline in below two conditions. In the condition two below, the bullet or number is also deleted unexpectedly.
Two Condition:
1. No other character before and after the selected text, and there's lines(one or more, blank line or lines with characters)after the line which selected text is located.
2. Bullet or Number for the line which the selected text is located in. No other character before and after the selected text, and there's lines(one or more, blank line or lines with characters) after the line which selected text is located.
Code:
Outlook.Application myApplication = Globals.ThisAddIn.Application;
Outlook.Inspector inspector = myApplication.ActiveInspector();
Word.Document document = (Word.Document)inspector.WordEditor;
object selectedText = document.Application.Selection.Text.TrimEnd('\r');
object missing = Type.Missing;
object address = document.Application.Selection.Text.TrimEnd('\r');
document.Application.Selection.Hyperlinks.Add(document.Application.Selection.Range, ref address, ref missing, ref missing, ref selectedText, ref missing);
Any of you met this situation before? Why this happened? Any fix way/workaround?
I'm working with a PowerPoint document which annoyingly sets all newly inserted text boxes' color to Red and uses Century Gothic. I believe this is due to the Master Slide being used by the document.
I would like to remove this automatic setting from text boxes in the Master Slide but I cannot figure out how?
I have gone into the Master Slide view and found that there are no text physical text boxes, there are however "Text Placeholders" but no text boxes. I find it strange and wonder:
how are these newly inserted text boxes contain pre-set font type and color?
If you aren't trying to do this in code, StackOverflow isn't really the right place for the question; you want SuperUser for "How do I ..." questions that don't involve code.
But what you want to do is select a text box that's formatted the way you want default text to be, then right click it and choose Set As Default Text Box. You won't get that option if you've clicked WITHIN the text box and have an insertion cursor; in that case press ESC, then rightclick.
If you're trying to do this in code, select a text box formatted to taste then do something like this:
Sub SetMeAsDefault()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.SetShapesDefaultProperties
End With
End Sub
The shape and text box defaults are independent of master formatting, which controls only the formatting of placeholders and text within placeholders. Text/shapes inserted via the Insert ribbon/menu follow the defaults set for the presentation as I've described above. Each presentation (and template) can have its own set of defaults.