A Text value change on Powerpoint by using OpenXml doesn't fit - vb.net

I use OpenXml for creating custom powerpoint presentation in this way: I put a keyword on the presentation, I found it during process with OpenXml and change the text value. Everything work fine but the fit option doesn't work at first.
The text box has options "Autofit: Shrink text on overflow; Wrap text in shape: On"
After my process, the new text appear on the right place but the autofit is not done, I need to click on the text box and make a input for see the autofit work. I think that PowerPoint only check option after a modification.
What I want is the autofit option is called at the end of the process. Can anyone help me?
I hope you understand what I want to do.
Thanks.

It's not possible using just OpenXML. The <a:normAutofit/> tag is used by a client application, such as PowerPoint, to render the text larger or smaller, as needed. OpenXML doesn't actually render anything, so until the client does, it will just read the text as if it is not auto-fitted.
There are a few options to think of to control this - none of them great however. One would be to use VSTO or VBA in PowerPoint to check all shapes on PPTX open and if they have a AutoFit tag, to re-render them. A second way would be to do all the font measurements yourself based on the shape's width & height and then set the font scale to the appropriate percentage. Another would be to make a textbox large enough to fit the largest amount of text you will ever insert and then turn autofit off.
Sorry this doesn't really help you immediately. I've done tons of research on this particular subject and it's all bad news.

Related

How can I set the line height of a multi-line PDF form field, and save it so it doesn't get reset by filling it?

I am having the exact same issue described in this question: Multiline pdf text box
I have a PDF that has some dotted lines that I want to convert into a fillable multi-line field. I tried the solution in the linked question, but my setting is not staying when I try to fill in the field outside of Acrobat.
When I am preparing the form inside Acrobat, I set the line height to 30 and it is lining up fine:
But when I save this PDF and then try to fill in the field outside of Acrobat, the line height setting does not stay. It gets reset every time:
It's super frustrating and I have scoured the internet looking for an answer but I have nothing yet. If someone knows what to do to get the line height looking like the first screenshot, please save my sanity.
I'm using Adobe Acrobat Pro DC 2021.001.20135 on macOS 10.14.6.
Thank you
You can't. Those settings don't "stick" when the field is cleared and there's no way to set them programmatically. It's best to simply remove the lines from the PDF.
As #joelgeraci stated, the settings don't stick.
However, if the form has to be manually fillable, removing the writing lines may not be the best idea. In this situation, it would be better to change the field's background color. When the field has no content, its background color is transparent, otherwise white. And that will cover the writing lines.

PoiwerPoint auto-updating text boxes

I want to know if there is a way to link text boxes in PowerPoint in a similar fashion as Excel so that when I update one text box (for instance, changing the title of the presentation), the other linked text boxes will update by themselves. The purpose is to avoid having to go through the whole presentation to change manually every relevant slides. I don't think there is a build in function but I am fairly new to VBA in PowerPoint (have some experience with Excel already). Any input is very much appreciated, thank you!

Access Report: Wrap Text Not Working

I have a report with unbound textbox's in them. I populate these fields onLoad.
The problem, though, is that the if the text is too long, it will not wrap. I have set Can Grow = Yes but this does not seem to work.
Is it due to the fact I am adding the string to the field OnLoad? If so, how can I overcome this and force the text to wrap? I would want the width to remain constant, but the height to grow.
Figured this out... I right clicked the text box and selected Size > To Fit...
I had the box big enough to accommodate a second line. It wouldn't ever word wrap until I made the change above. Can Grow and Can Shrink did nothing, but I left them selected.
I open report from code in design mode, make changes to control source of the text fields, save and close report and lastly open it in preview mode. The only way I get what I want.
I know this is an old post but I've been running into the same issue and haven't been able to figure out a solution until now.
One of the fields in print preview was getting cut off for me and despite my best efforts to make sure all the formatting settings were correct (i.e. Can Grow/Shrink: On) for both the detail section and the specific field. Again, this issue only happened in print preview, which meant the reports that were getting printed had the text cut off.
Solution:
I ended up realizing that all of the other text fields were set to Plain Text and the text field giving me the issue was set to Rich Text. I changed it to Plain Text and voila! It displayed everything without any issues.
My guess is that if you're having this issue, make sure all of the fields are set to the same property (Rich Text/Plain Text). Not sure why Access has trouble with this but I hope this solution helps someone else out.
The simple solution to this huge problem is listed below.
Convert the property of the textbox from plain text to rich text.
Set the text align property to distribute.
Enable can shrink and can grow property of the text box. (Yes)
Done.
After a lot trial-and-error, the solution seems to be that the text box that you want to scroll must have enough height to show two vertical lines. A textbox that is only one line high will not scroll. (You must also have Can Grow set to 'Yes' for both the textbox and the detail section.)
You also have to have the CAN GROW of the section that the text box is in set to YES as well as the text box.

save textbox as picture in powerpoint_transparancy difficulties

In powerpoint 2010 I want to save an inserted textbox as a picture, which is simply done by right-clicking on the text box and save it. The saved image will however include a large amount of transparancy around the text. I am wondering whether this abundance of transparency around the text can be reduced, whithout using photo-editing programs.
I understand that powerpoint is not the right tool to use the beautifuly created texts for other purposes aside from office itself, however this would make things ten times easier for some coworkers of mine.
I hope someone can help me with this, also if it means using VBA or other (complex) codes/languages.
Thnx for your time.
Mike
Once you have typed your text in the textbox,
Copy the text box, right-click and paste as image
Now you have the image of the text box as you will get while saving that textbox as image - - using the save_as_image option
Select this image and click on format tab
You have an option to crop your image
Crop the image and save it as a picture

Programatically extract content of PowerPoint slides into MS Word-like format?

I'd like to extract all of the information (formatted text, images, etc) from powerpoint slides into a flowing, readable (MS Word-style) format.
I'm not interested in keeping the slide concept at all--think of taking class slides from a college course and batch converting them all into one collective study guide.
I can't find a way to do this within powerpoint (though if you know of one, please share!) and,
I don't have experience scripting Office apps. Is this kind of thing easily done? Does this kind of script already exist somewhere?
Clarification:
In an earlier version of this post, I used the word "flowing" to refer to a slide-free (MS Word-like) format. This does not, however, refer to the actual formatting of slide content. So keeping bullet lists, etc. is fine and even desirable.
I don't see this being a simple task. College professors use a format of either "TITLE: BULLET POINTS OR IMAGE" or "EVERY WORD I'M ABOUT TO SAY" for their slides in my experience, and you're just not going to get flowing, readable text from the former no matter what you do. For the latter, you've already got your text, you just have to copy it to another document.
I think you might as well just open the PowerPoint, select all the text, and copy+paste into Word/Publisher/InDesign/your favorite page layout program. You'll have the same effect and the same amount of editing after the fact except without all the hassle of writing a program to do it for you.
Doing a Print operation to a PDF with the N-up options might be a good solution for handouts if that's all you need. You could expand the idea and condense ALL the slide decks into one, get it printed (with N slides per page and the note space next to it) and bound, and voila, instant study guide. I've seen that, and then you get options for note taking.
More power to you if you're doing this just because you can - don't let me stop you. There is much good learning to be had that way. You might want to look into writing a program using the Microsoft.Office.Interop namespace in .NET (starting at http://msdn.microsoft.com/en-us/library/bb772069.aspx ), or perhaps look on CPAN ( http://search.cpan.org/search?mode=all&query=powerpoint ) and do it with Perl! There are lots of ways to do it, but you've got to be up for the challenge.
Text is fairly simple to extract, but what text do you want? The text from the title and body text placeholders only? File, Save As, and choose to save the outline.
The other text on the slide? That can be pulled out to a text file programmatically, but in what order? Suppose you have a complex diagram with text callouts. Extracting the text is going to give you gibberish. There's no obvious/meaningful order to the text other than what the human viewer supplies by noting that "Ah. The arrow next to this bit of text points to the fribulator sub-assembly, so must relate to it in some way." Try doing that in code. ;-)
You could give the author a way to sort the text into reading order so that the code knows what order to extract it in, but that would require a fair amount of work on the part of the author.
If you can be certain that all of the content is in title+bullet form, no worries. Otherwise, you'd have to be able to articulate exactly what you want extracted, in what form and in what order before you could get anywhere with this.
MS Word-style is not only readable, but writeable as well (which was not specified in your requirements). If you want a read-only guide, PDF is your natural choice (either through Acrobat Distiller or LibreOffice). Combine individual Acrobatted presentations with PDFtk, or Acrobat or Foxit and you're good to go without any programming at all.
"Is this kind of thing easily done?" - Yes, your humble servant did a couple of similar scripts ages ago (extracting enhanced metafiles from Powerpoint slides).
"Does this kind of script already exist somewhere?" - Yes. Probably at hundreds of places, but not sure if any of them get posted to the 'Net. All things considered think you'd be better off learning some scripting and macro programming on your own, since a ready-made script may be not quite fit for your needs - and to understand and rewrite it you'd need more time than to code & debug from scratch.
Since you mention that title+bullet form is ok, open the file, choose to save as and pick Outline as the save-as type.
I think you could parse through the PowerPoint file for formatting, text and pictures. There are Visual Studio namespaces available for such a task. You open the file, parse through it and make Word file from these. Complicated work, as you would have to consider type of elements and their position, you would have to use a temporary structure for each slide.
Have a look at this sample code :
http://msdn.microsoft.com/en-us/library/office/gg278331.aspx
How to: Get All the Text in All Slides in a Presentation
Basically, using c# and openXML SDK 2.0, it loops through all the slides in the presentation, and then adds each text in every slide into a string builder. You can write out the result into a text file if you like (modification required).
Recommendation: <25 oct 2012>
For your study guide, maybe you could extract all the text in each slide, and dump those text programmatically (by adding that function into the sample code above while it's iterating the slides) into the "Notes" section of each slide. With that, you can print it in Notes Page view. You'll get the entire slide image at the top half of the page, and the actual slide texts at the bottom of it in the Notes Page view. It sure beats trying to copy and paste all the text from the slide into the notes section. You can even print it 2 slides per page, as small text would not be an issue inside the slide's image, and diagrams would still be visible more or less.
Unfortunatly, this method works for simple standard slide format ... meaning, it's OK if your slides just have a title, and a center text box with all the bullet points... any complex slide layout (maybe text boxes scattered everywhere) will come out in non-order and will be confusing. But at least you can still look at the slide image above to make sense of it :)