Skip to content

How To: Write SDEF files

SDEF is the Standard Data Exchange Format, as defined by the USACE (United States Army Corps of Engineers). SDEF is a fixed column format text file, used to import a project schedule up into the QCS (Quality Control System) software from USACE. The specification for the file format can be found here.

Writing SDEF files

The sample code below illustrates how to write data to an SDEF file.

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.writer.FileFormat;
import net.sf.mpxj.writer.UniversalProjectWriter;

// ...

new UniversalProjectWriter(FileFormat.SDEF).write(project, fileName);

Using SDEFWriter

If required, the SDEFWriter class can be used directly, which provides access to additional options, as described below.


By default SDEF files are written using the US_ASCII charset. The setCharset method on the SDEFWriter class can be used to change this if required:

import java.nio.charset.StandardCharsets;

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.sdef.SDEFWriter;

// ...

SDEFWriter writer = new SDEFWriter();
writer.write(projectFile, outputFileName);