I have the following code snippet to add a slide to the end of a Microsoft PowerPoint presentation and designate a title / subtitle:
longSlideCount = ActivePresentation.Slides.Count
With ActivePresentation.Slides
Set slideObject = .Add(longSlideCount + 1, ppLayoutTitle)
End With
' ------------------------------ make the main title ------------------------------------- '
slideObject.Shapes(1).TextFrame.TextRange.Text = "This is the Main Title Text"
slideObject.Shapes(2).TextFrame.TextRange.Text = "This is the SubTitle Text"
Is it possible to shrink / grow the text in the title string to fit on one line in the text frame?
Use .Textframe2.Autosize = msoAutoSizeTextToFitShape
Related
How to decode spacial character in xamairn forms
Inside my label text = "Sample & Text"
instead of showing original text, its showing "Sample & Text"
so how to solve this?
& is used for displaying & in XAML. If you want to display Sample & Text on code behind, there's no need to encode it to Sample & Text. You could set the value directly. i.e. here is a list view's items source:
var list = new List<string>();
for (int i=0; i<10; i++)
{
var str = "Sample & Text";
list.Add(str);
}
listView.ItemsSource = list;
It shows correctly:
However, if your original text from the server is Sample & Text and you want to display the decoded format, you can try System.Net.WebUtility.HtmlDecode():
var str = System.Net.WebUtility.HtmlDecode("Sample & Text");
Try this:
<Label Text="Sample &Text"/>
This will display "Sample & Text"
I have a picture box and I print contents in it. I want to know the exact textwidth of the text in millimeters. But I get wrong value. here is my code
me.scalemode = vbmillimeters
picturebox.scalemode = vbmillimeters
picturebox.fontname = "Arial"
picturebox.fontsize = 12
debug.print textwidth("AB.C.D.E. FGHIJKLMN")
When i measure in the printout in paper it is 48 mm
but it shows 32.97mm
please help me where am wrong.
Thanks in advance
If you need the width of the text printed to the picture box, use:
PictureBox.textwidth("AB.C.D.E. FGHIJKLMN")
What you are actually doing: textwidth("AB.C.D.E. FGHIJKLMN") is mesuring the same text printed to the Form (Me).
Doing like this would be less error-prone:
Dim TextWidth as Single
With PictureBox
.ScaleMode = vbMillimeters
.FontName = "Arial"
.FontSize = 12
TextWidth = .TextWidth("AB.C.D.E. FGHIJKLMN")
End With
because if you are then switching to paper, you can also easily switch context:
With SelectedPrinter....
I am developing new vb 6 application, I want to display a scrolling text (marquee)
on a status bar like news Line text I already have two panels used and now in the
third panel I want to use marquee.
I have done following but text is scrolling from middle of the panel it should be
scrolled from the right end to left end continuously.
Dim i As Byte
dim txtSample As String
txtSample = " - - - MARQUEE TEXT - - - "
Private Sub Timer1_Timer()
i = i + 1
StatusBar1.Panels(3).Text = Mid(txtSample, i)
If i > Len(txtSample) Then i = 1
End Sub
You code is actually correct but you are actually reducing the content in a rapid manner makes it a marquee. So to make it start from far edge instead from the length of your string, you have to buffer your string with space to cover the whole panel visible area.. something like this should do
txtSample = Space(150) & "- - - MARQUEE TEXT - - - "
I have many power point slides and each slide has many lines but all those lines are in the same objects. I want now to add some animation including appears for each line with click.
How I can partition the lines in each slide such that every line will be in its own object
Note, I am using powerpoint 2010
Thanks,
AA
This isn't perfect; you'll need to add more code to pick up ALL of the formatting from the original text, but it's a start. Click within the text box you want to modify, then run the TEST sub. Once it's adjusted to your taste, it's a fairly simple matter to extend it to act on every text box in the entire presentation (though not tables, charts, smartart, stuff like that)
Sub Test()
TextBoxToLines ActiveWindow.Selection.ShapeRange(1)
End Sub
Sub TextBoxToLines(oSh As Shape)
Dim oSl As Slide
Dim oNewShape As Shape
Dim oRng As TextRange
Dim x As Long
With oSh
Set oSl = .Parent
With .TextFrame.TextRange
For x = 1 To .Paragraphs.Count
Set oRng = .Paragraphs(x)
Set oNewShape = oSl.Shapes.AddTextbox(msoTextOrientationHorizontal, _
oRng.BoundLeft, oRng.BoundTop, oRng.BoundWidth, oRng.BoundHeight)
With oNewShape
.TextFrame.AutoSize = ppAutoSizeNone
.Left = oRng.BoundLeft
.Top = oRng.BoundTop
.Width = oSh.Width
.Height = oSh.Height
With .TextFrame.TextRange
.Text = oRng.Text
.Font.Name = oRng.Font.Name
.Font.Size = oRng.Font.Size
' etc ... pick up any other font formatting you need
' from oRng, which represents the current paragraph of
' the original text
' Bullets, tabs, etc.
End With
End With
Next
End With
End With
oSh.Delete
End Sub
I am trying to generate a PDF using iTextSharp.
It will consists of a number of images, each with a heading preceding it. But when I generate the PDF, the order of the elements is not preserved - multiple headings are grouped together etc.
I am wrapping the header and image in a single paragraph as follows:
' Create paragraph and heading
Dim paragraph As New iTextSharp.text.Paragraph()
Dim heading As New iTextSharp.text.Chunk("Image title" & vbNewLine, pdfHeadingFont)
' Create image from Chart
Dim image = GetPdfImage(Me.chtMain)
Dim width = iTextSharp.text.PageSize.A4.Width - pdfDocument.LeftMargin - pdfDocument.RightMargin
Dim height = iTextSharp.text.PageSize.A4.Height - pdfDocument.TopMargin - pdfDocument.BottomMargin
image.Alignment = image.ALIGN_CENTER Or image.TEXTWRAP
image.ScaleToFit(width, height)
' Add heading and image to paragraph
paragraph.Add(heading)
paragraph.Add(image)
' Add paragraph to document
pdfDocument.Add(paragraph)
Why are the image and heading not placed together in the PDF? Could I be doing this in some other way?
Thank you,
Martin
Figured it out, thanks to this question.
Apparently, setting PdfWriter.StrictImageSequence = true resolves this issue.
iTextSharp "optimizes" your document by trying to fit as many paragraphs as possible on every single page - regardless of order.