Stripy42
Stripy42

Reputation: 113

Found the root of the PowerPoint SpellChecker bug - Now, how do I use VBA to fix a file?

In PowerPoint (2007 at least, but probably others), it refuses to spell check "some" text in some shapes.

I thought it was the type of shape, so changed them, this didn't fix it. So I did some experiments moving what I called "infected" text into a few boxes and saw that it was somehow attached to the text.

Taking a very simple file with known infected and uninfected sections I converted the .pptx to a .zip and opened .\ppt\slides\slide1.xml

In here text which won't spell check is inclosed with:

<a:rPr noProof="1" ...

Text which is spelt ok, or had "ignore" pressed in inclosed with:

<a:rPr dirty="0" smtClean="0" ...

And missspelled text, that was found with:

<a:rPr dirty="0" smtClean="0" err="1" ...

I found and deleted all the noProof="1"s in the file, returned it to the countainer and opened the presentation. and everything spell check as I would expect it should, all errors in all boxes were found, without damaging the file.

After saving it, I reopened the silde1.xml and found dirty="0" smtClean="0" or dirty="0" smtClean="0" err="1" in the correct places.

Now the question is, how do I use this new found knowledge to fix a file, without manualy exstracting all the slide#.xml files, opening them in a text editor and using "Replace" to fix them?

That process of exstraction could be automated, but if it is possible to do from VBA within PowerPoint it would be easier.

Thanks, Andrew

Upvotes: 2

Views: 883

Answers (3)

Stripy42
Stripy42

Reputation: 113

I have finally found a way to fix this using scripting (at least part of the process) using powershell.

  1. Rename the .pptx file to .zip
  2. Navigate to \ppt\slides
  3. Extract the slide*.xml files
  4. Run Windows Powershell
  5. Navigate the folder containing the extracted xml files
  6. Paste the following code:

    $configFiles=get-childitem . *.xml -rec

    foreach ($file in $configFiles) { (Get-Content $file.PSPath) | Foreach-Object {$_ -replace ' noProof="1"', ''} | Set-Content $file.PSPath }

  7. Put the xml files back into the zip file

  8. Rename the .zip file back to .pptx,
  9. Result: a Powerpoint file that spell checks correctly.

Upvotes: 1

Tom Gez
Tom Gez

Reputation: 11

I know you asked for a specific answer regarding PowerPoint not spell checking in "some" areas.

I want to suggest to you a program I use called Spell Check Anywhere. It adds spell checking to all Windows programs, including PowerPoint. So you will be able to spell check in any Windows program, anywhere you type.

The spell checking is very high quality, much better word suggestions, than even Word gives.

It also comes with speed typing.

So while you are looking for a solution for PowerPoint, this program, will give you a solution to your entire spell checking needs.

Thanks, Tomer

Upvotes: 1

rakesh
rakesh

Reputation: 338

Nice find. Not sure if there is an way to do this via the VBA API. But you should be able to do this using the OpenXML API. This might need be coded as a .net project.

http://www.microsoft.com/download/en/details.aspx?id=5124

Upvotes: 1

Related Questions