No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
OfficeDoc - read/write/format MS Office docs (XLS/DOC/PPT)

2.5 | 14 ratings Rate this file 75 Downloads (last 30 days) File Size: 127 KB File ID: #15192 Version: 1.0
image thumbnail

OfficeDoc - read/write/format MS Office docs (XLS/DOC/PPT)


Yair Altman (view profile)


04 Jun 2007 (Updated )

Read/write/append/format/display data, images & screenshots in MS Office documents (XLS/DOC/PPT)

| Watch this File

File Information

OfficeDoc reads/writes/appends and formats data, images & figure screenshots in Microsoft Office documents, from within the Matlab environment. Supported formats include XLS (Excel), DOC (Word) & PPT (PowerPoint). Opening/closing COM server connection and files is user-controllable, enabling very fast sequential writes. Numerous format properties enable highly customizable output.

This function is meant as a direct replacement for Matlab's built-in xlsread/xlswrite functions. There is no comparable built-in Matlab support for DOC/PPT.

Due to the vast number of possible actions and properties, an extensive documentation facility was included: see the internal help or attached webpages.

A basic usage example follows. Please read the built-in documentation for more detailed examples:
>> [file,status] = officedoc(fileName, 'open', 'mode','append');
>> status = officedoc(file, 'write', 'title','My data',...
  'data',[1,2;3,4], 'image',gcf, 'bold',1,'fgcolor','b');
>> status = officedoc(file, 'close');

Note: this submission is a free version of OfficeDoc. All the important OfficeDoc features are included in this free version - the professional version (available on allows extra formatting options.

Bugs and suggestions:
OfficeDoc was tested on Office 11 (XP) & Matlab 6.0 (R12) - 7.4 (R2007a), but might also work on earlier versions of Matlab & Office. Please report any incompatibilities or other bugs/suggestions to Yair Altman (altmany at gmail dot com).

PC Windows (might work on Macs too). Microsoft Office (duh!)


Saveppt, Save2word, and Xlswrite1 inspired this file.

MATLAB release MATLAB 6.0 (R12)
Other requirements Matlab 6+; Windows PC; MS Office
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (23)
08 Feb 2017 Carl Witthoft

Failure to provide source code should be grounds for removal from FileEx.

06 Feb 2017 Ingrid

Ingrid (view profile)

were can I find another similar utility? I just want to read in a word document by Matlab but the p-code is no longer supported since it was compiled prior to R2007b

Comment only
20 Sep 2016 Yair Altman

Yair Altman (view profile)

Note to everyone:
OfficeDoc is provided as-is. This is a very old utility - I no longer support it, and the source code is not available. If you don't like this, simply use another utility.

Comment only
20 Sep 2016 cr

cr (view profile)

20 Sep 2016 cr

cr (view profile)

17 Jun 2016 Benjamin Levy

Dear Sir,

I'd like to re-compile officedoc.m with pcode(). My platform is Windows 7 (professional), 64-bit, Matlab 64-bit, version, R2015b. Is this possible at all and can you offer hints? I've followed the directions of the pcode documentation, but you've not provided the *.m function. So, no luck.

Thank you.


Comment only
29 Aug 2014 Tim Campbell

Free and Pro updated p-code can be found through the professional version link, copied below:

Comment only
14 Apr 2014 Richard Moore

Richard Moore (view profile)

Can you generate an updated P-code that works for MATLAB >7.5?

Comment only
12 Apr 2014 vaka sindhu

how to read string from ms word and display it

Comment only
13 Jun 2013 Jamie

Jamie (view profile)

Looks superb. unfortunatly a 'no go' on later matlab versions

06 Jun 2012 shandong qingdao


09 May 2012 Wei

Wei (view profile)

no source code and the pcode does not work on r2011b

11 Nov 2010 Riasat Abir

I want to write characters to a doc file using unicode value with a specific font of my mother tongue.
How to do it?
need help please, thanks in advance..

Comment only
19 Sep 2010 Prashant Patil

even the example included needs professional version

27 Nov 2009 Asbjorn

27 Nov 2009 Asbjorn

Seems to very nice software but I have to agree with Stephane, it is not open source. With the demo version you do not get the same functionality as xlswrite (the option to adress the fields where one wants to write data to is not included)

23 Jul 2009 Anthony T

12 Apr 2008 Gene Harding

Very helpful for creating MS Word documents.

04 Sep 2007 murali mohan

The information given by u is very useful

19 Jul 2007 ifeanyi philip

we need the formting leasonson mms word office

Comment only
18 Jul 2007 Stephane ARMAND

Not open source!!!!

25 Jun 2007 DoubleW Jay

I doubt it it will work on a mac since the OfficeDoc uses ActiveX.

Comment only
05 Jun 2007 Amir Ibrahim

Works nicely, and very useful.

Very handy to easily format excel sheets generated from within matlab.

05 Jun 2007

updated documentation

Contact us