Showing posts with label XLSX. Show all posts
Showing posts with label XLSX. Show all posts

Jul 10, 2013

Coping with objects and graphics to translate in Microsoft Office documents

About a year ago, I published a series of posts describing a simple way to get at the objects and graphics embedded in Microsoft Office documents, such as Microsoft Word DOCX documents or PowerPoint PPTX presentations. These investigations were inspired by a series of jobs where I had to cope with up to 60 embedded Excel tables in a Microsoft Word document. The four related posts are:
The post titles may differ a little from the text in the links here, which is updated for a little more clarity.

I've also added two short videos to my YouTube channel which illustrate how to remove embedded objects from a DOCX for translating separately from the Microsoft Word document and how to put them back afterward.

Here's how to extract the embeddings folder from the DOCX file:



And here is how to put the translated embedded objects into the DOCX file and refresh the view of the embedded objects in your translation:



These and other videos I've produced recently are part of an effort I began recently to develop integrated courses for self-instruction and review with software tools used by many of us. These courses use the Moodle platform and offer text, screenshots, audio, video and data files such as examples of file formats to translate, backups of memoQ practice projects to restore on your local computer for training, configuration resources for memoQ, useful macros to support work with many translation environment (CAT) tools and a host of other resources and learning links.

Dec 7, 2012

Terminology collaboration with Google Docs: new twists

A few years ago, I put a notice in this blog about a colleague's interesting use of Google Docs to share terminology with faraway colleagues in a project. Earlier this year I enjoyed a similar collaboration with a Google Docs spreadsheet used to exchange and update terminology on a very time-critical annual report with translators using two different versions of Trados, memoQ and no CAT tools at all.

Sharing information via Google Docs was quite easy, and we were able to configure the access rights without a lot of trouble. But at the time I still had a bit of extra, annoying effort to get the data imported into my working environment for frequent updates.

Tonight another colleague contacted me with basically the same problem. Her client manages data in an Excel spreadsheet, which gets updated and sent out frequently. She already had the idea that this might work better in Google Docs, and I agreed.

But I kept thinking about that annoying update problem....

One can, of course, export Google Docs spreadsheet data in various formats:


I've marked a few of the export ("download") formats which are probably useful for a subsequent import into a translation environment too. But the downloaded data still won't be in the "perfect" format in many cases, and there will be extra steps involved in matching it up to the fields in your term base.

One way to simplify this problem is to create another online spreadsheet in Google Docs and link it to the original, shared spreadsheet. In this second spreadsheet, which is your "personal" copy for use in your favorite tool, you reformat the data so they will export in a form that makes your later import to your tool's termbase easier.

In my case, I use memoQ, so I created a Google Docs spreadsheet with the first row containing the default field names of interest from the CSV export of my memoQ termbase:

I linked the columns in my personal online spreadsheet with the shared spreadsheet using the ImportRange command. It has two arguments, both of which have to enclosed in quotes. The first one (argument #1 above) is the key for the online spreadsheet to be referenced; it is shown in the URL of the online spreadsheet (just look in the address bar of your browser and you will see it). The second one specifies the sheet and the range of cells to copy. I put this formula in one cell and it copied the entire column for me.

I could, if I wanted to, use conditional (IF) statements and other tricks to transform some data in columns of the other sheet and build the semicolon-delimited term properties list (Term_Info) that memoQ uses to keep track of gender, capitalization enforcement, forbidden status, etc. But none of that is needed for simple sharing of terms, definitions and examples for instance.

I simply export my personal Google Docs spreadshit as CSV, then import it into my desired termbase in memoQ. If I have IDs set for the term entries in the online spreadsheet, I could even choose ID-based updates of my local termbase when I do the import.

Those who use other tools, such as Trados, OmegaT or WordFast can set up their spreadsheets and do exports as best suits their needs.

This approach enables you to take source data in nearly any format in an online spreadsheet and rework it for the greatest convenience in the tool of your choice. Although not a "perfect" solution, it is perhaps a convenient one until better resources are commonly available for dynamic, cross-platform translation collaboration.

So what do I recommend my friend to try as a first step? Maybe take the client's latest spreadsheet, copy and paste it into Google Docs and share it with the client and others on the team. Then it's already "up there" for everyone's convenience (local XLSX copies can be downloaded any time), and she can get on with creating a convenient "view" of this shared data in her personal spreadsheet, which can be exported for local use any time. That personal sheet could also be shared (read only access recommended) with other team members using the same translation environment tool.

Aug 29, 2012

Replacing bitmap graphics in MS Office 2007/2010

A few weeks ago I published a series of posts about different aspects of embedded objects in DOCX, XLSX and PPTX files and how to translate them a bit more conveniently. When I described this procedure to a colleague this afternoon, he thought it was a solution for convenient substitution of bitmap graphics in these files as well. Well, sort of, but not quite.

If you rename the extension of a DOCX file to ZIP and open the ZIP file using Windows Explorer (in order not to mess up the compression), you will see a folder named word.


 Inside this word folder are other folders of interest:


The embeddings folder has the objects such as Excel tables or PowerPoint slides described in previous posts. The bitmap graphics or pictures are in the media folder, however:


The view inside the media folder above shows one bitmap graphic (the JPEG file) and various other files with images of the embedded objects (an equation, and Excel table and a PowerPoint slide). Only the bitmap files are of real interest. If other graphic files localized for the target language are named the same as the original files in the media folder and substituted there, when the ZIP files is renamed to have its original extension, the substituted graphics will appear in the document the next time it is opened.

This way, for example, screen shots for an entire file can be substituted quickly. One could, of course do this by a number of other means, but this way is fairly convenient and could probably be automated without much ado if your organization needs to make such substitutions a lot.


Addendum: I was curious about those other files in the media folder - the ones with the views of the embedded objects. So I deleted them to see if they would re-generate when the document is opened. Instead, this message was displayed at the location of each object:


Double-clicking the "broken" object display opened the object and restored the view. So clearly, refreshing object views involves updating the content of the media folder.

Jul 27, 2012

Translating embedded objects in Microsoft Office documents

Yesterday a colleague sent me a note to say he had been searching my blog for information about translating compound Microsoft Office documents (that is documents with embedded objects) in memoQ and couldn't find any. I presume he was referring to the article about how often one CAT tool is not enough - combined workflows with other tools can frequently help solve many tricky translation problems, and DVX2 or STAR TRANSIT are definitely useful options for preparing compound Microsoft Office documents for translation in memoQ. Some time ago I recommended using STAR TRANSIT as a pre-processing tool to one of my agency friends, and he carried out a very large, complex project successfully using memoQ's excellent integration features for STAR TRANSIT projects.

There is, of course, another simple way to translate the embedded objects in a Microsoft Office document that does not involve purchasing other software licenses. I don't usually talk about it, because there are a few limitations, and until recently I had not figured out how to avoid corrupting the files when I tried to do things the "easy" way. This approach is not limited to memoQ and will actually work with most CAT tools - so SDL Trados Studio users can do this as well, for example.

It is useful to know that the Microsoft Office 2007/2010 file formats (DOCX, PPTX, XLSX) are really just ZIP files containing XML and a bunch of other stuff. That stuff includes a folder with the embedded objects in formats that can be dealt with directly.

If you have an older, binary MS Office document (DOC, PPT, XLS) with embedded objects, convert it to a 2007/2010 format.

If you rename the file extension DOCX, PPTX or XSLX to ZIP and unpack the ZIP file, inside the folder you will find a folder called "embeddings". The files in that folder can be copied elsewhere and usually handled directly in your CAT tool. But problems usually arise when you put them back, rezip the folder and change back to the original extension. The compression gets screwed up, and the Microsoft Office file is corrupted and won't open.

The only reliable method I have found for avoiding this is to use the Windows Explorer (under Windows 7) to open the ZIP file:



Here's what the "guts" of one DOCX file with a bunch of embedded Excel tables looks like:

Inside the word folder you'll find the embeddings folder:

The contents of the embeddings folder look like this:


Simply copy the embeddings folder somewhere safe, translate its contents, then copy them back to the ZIP file using Windows Explorer. Then rename the ZIP extension to the original extension for the file.

If you open the file and look at it, you'll get a shock. When you see all the objects in their original language, you might think something went wrong. Nothing bad has happened; you merely need to refresh the objects. This can be done by opening each briefly to edit or using a macro to open each object and close it again quickly. In a job with dozens of embedded objects in a long file, this macro is a helpful shortcut.

Given how easily accessible this embedded content actually is, one has to wonder why other major CAT tool providers like SDL and Kilgray have failed to offer the option of importing embedded content in their filters up to now. Let's hope they do soon. In the meantime, this workaround should enable many people to deal with this complex and irritating file format challenge.

Here's a summary of the procedure once again:
  1. Rename the *.???x file to *.zip 
  2. Under Windows 7, right-click on the ZIP file and open it using the Windows Explorer. Using ZIP tools of any kind risks corruption by changing the compression ratios. 
  3. Find the embeddings folder inside the ZIP structure. Copy this elsewhere and use it as the source for translation. It will contain all the embedded objects as single files. 
  4. Copy the translated content back into the embeddings folder in the ZIP structure.
  5. Rename the ZIP file to its original extension. 
  6. Open the file and refresh each embedded object (which will initially appear not to have been translated) by right-clicking and opening it from the context menu or running a macro to do that.