When is the "o:gfxdata" element in the DOCX format actually used by MSWORD? Is it only specific versions?

2024-12-24T07:47:33.2566667+00:00

I have recently wondered if the "o:gfxdata" element in OOXML files (docx) is actually ever used by MSWORD, and if so, by which versions and to what end?

This element is added to images and graphic objects when I embed them in Word.

Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
909 questions
Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
140 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Mohit Pandey 95 Reputation points
    2024-12-24T11:35:05.23+00:00

    The <o:gfxdata> element in the DOCX format is part of the Office Open XML (OOXML) specification, which is used internally by Microsoft Word to store graphical or image-related data, typically when working with graphics, shapes, charts, and other drawing objects. This element is particularly used for encoding vector graphic data in certain contexts.

    When is <o:gfxdata> used by Microsoft Word?

    The <o:gfxdata> element is specifically used when a document contains Office Drawing objects, such as:

    1. Shapes and Drawing Objects: This includes shapes like rectangles, ellipses, lines, and other drawing objects that are embedded in Word documents.
    2. Charts: When a chart (like a bar chart, line graph, or pie chart) is embedded in the document, the graphical data of the chart, including vector graphics, can be stored in this element.
    3. SmartArt Graphics: The element might also be used when SmartArt graphics are included in the document.
    4. Pictures with Transparency or Complex Graphics: In some cases, if a picture or graphic has a complex structure (e.g., SVG images or pictures with alpha transparency), this element might be used to store parts of the image data in vector format. Is it used in all versions of MS Word? The use of the <o:gfxdata> element is version-specific, but it is primarily used in newer versions of Microsoft Word that support more complex graphical objects and embedding of vector-based data. This feature is generally used in Word 2007 and later, as these versions adopted the Office Open XML (OOXML) format.

  2. Mike Bowen 1,791 Reputation points Microsoft Employee
    2024-12-26T22:15:53.78+00:00

    Hi @יונתן אלכסנדר גרינטל , Thanks for your question. The o:gxfdata attribute is defined in [ISO/IEC-29500-4] §19.1.2.19; shape (Shape Definition). It is defined:

    Specifies a base-64 encoded package as defined in ISO/IEC 29500-2 that contains> DrawingML content as defined in ISO/IEC 29500-1. [Rationale: This attribute allows an> application to use VML to represent graphical content for a legacy document while still> persisting DrawingML for consuming applications that support DrawingML. For example,> a diagram stored within this attribute would have the four parts defined for a DrawingML> diagram, as well as any number of application-defined parts and relationships. end> rationale] [Example: A DrawingML object is encoded in the gfxdata attribute, leaving VML to handle the visual display:

    <v:shape id="Diagram 1" o:spid="_x0000_i1025" type="#_x0000_t75" style="width:446.25pt;height:252pt; visibility:visible" o:gfxdata="UEsDBBQABgAIAAAAIQDIu8KcTQE…">  <v:imagedata r:id="rId4" o:title=""/></v:shape>
    

    end example] The shape element, on which o:gfxdata is an attribute, is used to describe a shape, the core object in VML. From [ISO/IEC-29500-4] §19.1 VML:

    VML is a language for defining graphical objects in cases where DrawingML does not apply, such as text boxes and shapes in WordprocessingML documents and comments and controls in SpreadsheetML documents.

    ...

    [Note: The VML format is a legacy format used in an existing corpus of binary documents and is included and> fully defined in ISO/IEC 29500 for backwards compatibility reasons. The DrawingML format is a newer and richer> format created with the goal of eventually replacing any uses of VML in the Office Open XML formats. VML> should be considered a transitional format included in Office Open XML for legacy reasons only and new> applications that need a file format for drawings are strongly encouraged to use preferentially DrawingML. end note]

    So, to answer your question, currently certain graphical objects, such as shapes in WordprocessingML, are rendered using VMLand the o:gfxdata attribute on a shape element is added to maintain forward compatibility for applications that use DrawingML.

    I hope that answers your question.

    Michael Bowen

    Senior Escalation Engineer - Microsoft Open Specifications


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.