Error word document xml line 2

  • Remove From My Forums
  • Question

  • I have found a few solutions by opening document.xml and tried all of them but nothing fixes the problem. I am using the most recent version of Word. What should I do? This is really critical. Please help.


    Alvaro Ramirez Software Engineer

Answers

  • Hi,

    I modified a Word document and it could be opened without any warnings, and sent it to you via email.
    Could you receive my email and open the Word document?
    ______________
    Ashidacchi

    • Marked as answer by

      Tuesday, May 2, 2017 4:15 PM

OpenOffice. Ошибка формата файла в поддокументе…

Не редко, при работе в OpenOffice с файлами формата ods приходилось сталкиваться с ошибкой вида Ошибка формата файла в поддокументе имя_файла в позиции строка,столбец.

Пример:

Ошибка формата файла в поддокументе content.xml  в позиции 350,23(строка, столбец)

Решается проблема довольно просто.

Понадобятся некоторые программы:
1. Архиватор. Можно любой по вкусу (7zip, rar и т.д.).
2. Хороший редактор текста. Я бы посоветовал notepad++, скачать можно тут. Такие как WordPad, notepad, MS Word не подойдут.

Решаем проблему:
Открываем файл в архиваторе и видим примерно следующее:

Копируем (разархивируем) поврежденный файл (в моем случае это content.xml), например, на рабочий стол. И открываем его в программе notepad++.

Слева видим номера строк. Находим нужную нам (у меня это 350).
Строка в моем случае выглядит так:

<text:p>05.07.10<|text:p>

Ошибку видно сразу. Заменим <|text:p> на </text:p>. И сохраняем

Копируем уже исправленный файл обратно в архив, с заменой поврежденного. На этом все. Открываем файл и радуемся.

Читайте также

How to Repair Word Document XML Line 2 Column 0?

“I am using Microsoft Word 2007 in my Windows computer and today morning after finishing my work in Word file, I have saved it and exited. Soon after a minute I remembered that I should make some changes in it. So, I clicked on that Word file to open and edit it. However, instead of opening, it just displayed an error message that unspecified error Part: /word/document.xml, line 2. I don’t have any idea what this message indicates. It would be a great help for me if someone guides me the direction to overcome it”

Sometimes, Microsoft word cannot open the file which you have just saved a minute ago and displays an error message that error, Part: /word/document.xml, Line: 2, Column: In case you are worried to sort out the error message that you get during Word file usage, then keep your all tensions away. This is actually a XML error which is a software bug. Fortunately you can fix the issue using built in method facilitated by Microsoft Office. Here is how:

  • Right click on the Word file that you need to fix and then select “Rename” option
  • Now change the extension from .docx to .zip file and right click on it to choose the option “Extract Files”
  • When unzip screen displays, then just choose a safe location on your computer to put the unzipped file. Also make sure that the location you chosen is an empty directory
  • Open Word file which you have converted to ZIP and click on “Word” folder. You will find a file named “document.xml”
  • In notepad.exe search for TOC which is not in lower case and have numbers as well as underscore in it
  • Next find for capital XE and look around it to ensure that it is still in TOC section
  • Highlight the XML tag from the beginning till end and delete it
  • Save the file and in original Word file which is ZIP file now, highlight all the files and directories and right click on it to archive
  • Choose the ZIP format and create the archive with ZIP extension; Rename .zip to .docx and try to open it

The Word file should be able to open now. If you fail to open it, then it indicates that there is some issue in Word file which manual way failed to resolve. For this, you have to utilize reliable Word repair software to fix word document.xml line 2 column 0 issues without getting error message anymore.

Word file repair tool:

Yodot DOC Repair is the ultimate tool to fix Word document XML error on your Windows computer. This software is capable of repairing Word file which shows different errors due to corruption and stops you from accessing contents from it. Along with repairing, it will recover the attributes such as images, header, footer, hyperlinks, word art, tables and many more with the same format. It will assist you to fix Word file of any size and shows its preview so that you can check whether it has been properly repaired or not. In addition to this, one can utilize this software to fix Word DOC and DOCX file of any version namely Word 2000, 2002, 2003, 2007, 2010, 2013, and the latest 2016 on computer running with Windows 10, Windows 8.1, Windows 8, Windows Vista, Windows XP, Windows server 2003 and 2008 operating systems. You can use this software to fix Word found unreadable oontent error, Word cannot save due to file permission error, Word file association error, Word out of memory error, and other errors with .docx, and .doc files.

Instructions to remove XML error from Word file:

  • At first, download Yodot DOC Repair software and install it to your Windows computer
  • Once the download process is done, run it to begin the repair process
  • Main screen appears with “Browse” and “Repair” option
  • Browse for the corrupted Word file and start to repair it by just taping on “Repair” option
  • Now repair process will be started and you can view its status in status bar
  • Soon after the completion of repair process, you will be presented with a window where you can see the details of repaired Word file
  • Preview repaired Word file to check about its quality
  • Finally save fixed Word document to the desired location.

Useful Tips:

  • Avoid Working on Word file when there is continuous power fluctuation
  • Download proficient Antivirus software to remove bugs from your computer

I am using PHPOffice/PHPWord in my Laravel Application. It is used to generate a .docx document with results in tables. This works great for a document of 3 tables with 6 rows, but when there are more rows the document is generated but when opening it the following error occurs:

We're sorry, We can't open (documentname) because we found a problem with its contents.

Details: XML parsing error Location: Part:/word/document.xml, Line: 2, Column 14349. 

Now, I have started working on another result page where I would also want to generate a .docx document. This will contain 5 tables, but with 3 rows I get the same XML parsing error but in a different location (Location: Part: /word/document.xml, Line:4, Column:2888). Could someone explain to me whether this is a error in my code, or phpword/words?

I have done some troubleshooting by deleting everything, and slowly adding new rows. I have found the error but how could i fix it. The first two tables are generated good..

    $phpWord = new PhpOfficePhpWordPhpWord();

    $section = $phpWord->addSection();
    $section->addImage('../public/img/2.jpg', array('width' => 230, 'height' => 65, 'alignment' => 'left'));
    $section->addText('Project IDs:' . $parameter);
    $header =$section->addHeader();
    $header->addText('Results Summary');

    $section->addLine(
        array(
            'width'       => PhpOfficePhpWordSharedConverter::cmToPixel(16),
            'height'      => PhpOfficePhpWordSharedConverter::cmToPixel(0),
            'positioning' => 'absolute',
        )
    );
    $tableName = 'rStyle';
    $phpWord->addFontStyle($tableName, array('italic' => true, 'size' => 12));
    $thName = 'tStyle';
    $phpWord->addFontStyle($thName, array('bold' => true, 'size' => 9));

    $section->addText('General Information Table', $tableName);
    $fancyTableStyle = array('borderSize' => 6, 'borderColor' => '999999');
    $spanTableStyleName = 'Overview tables';
    $phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle);
    $table = $section->addTable($spanTableStyleName);
    $table->addRow(null, array('tblHeader' => true, 'cantSplit' => true));
    $table->addCell(1750)->addText('Project ID',$thName);
    $table->addCell(1750)->addText('Description',$thName);
    $table->addCell(1750)->addText('Notes',$thName);
    foreach ($id_array_explode as $char) {
        $table->addRow();
        $singlenumber = (int)$char;
        $cursor = $collection->find(array("id" => $singlenumber));
        foreach ($cursor as $document) {
                    $table->addCell(1750)->addText($document["project_id"]);
                    $table->addCell(1750)->addText($document["description"]);
                    $table->addCell(1750)->addText($document["notes"]);
        }
    }
    $section->addText('        
');
    $section->addLine(
        array(
            'width'       => PhpOfficePhpWordSharedConverter::cmToPixel(16),
            'height'      => PhpOfficePhpWordSharedConverter::cmToPixel(0),
            'positioning' => 'absolute',
        )
    );
    $section->addText('Input Table', $tableName);
    $table1 = $section->addTable($spanTableStyleName);
    $table1->addRow(null, array('tblHeader' => true, 'cantSplit' => true));
    $table1->addCell(1750)->addText('Project ID',$thName);
    $table1->addCell(1750)->addText('#',$thName);
    foreach ($id_array_explode as $char) {
        $table1->addRow();
        $singlenumber = (int)$char;
        $cursor = $collection->find(array("id" => $singlenumber));
        foreach ($cursor as $document) {
            if (is_array($document['input'])) {
                foreach ($document['input'] as $samples) {
                    $table1->addCell(1750)->addText($document["project_id"]);
                    $table1->addCell(1750)->addText($samples['nr']);
                }
            }
        }
    }
    $section->addText('        
');
    $section->addLine(
        array(
            'width'       => PhpOfficePhpWordSharedConverter::cmToPixel(16),
            'height'      => PhpOfficePhpWordSharedConverter::cmToPixel(0),
            'positioning' => 'absolute',
        )
    );
    $section->addText('Output Table', $tableName);
    $table2 = $section->addTable($spanTableStyleName);
//// THIS IS WHERE THE ERROR OCCURS!! 
        $table2->addRow(null, array('tblHeader' => true, 'cantSplit' => true));
        $table2->addCell(1750)->addText('ID',$thName);

Thank you!

SOLUTION
Oke, so I have deleted the whole document and added every single sentence separately to see where the error occurred. This led to seeing that the error came from the data which I was getting. It couldn’t handle «>» and «&» signs!

So, if you every have this error, check the data which you’re printing!

Word2013_error1

Today while I was editing a document suddenly Word crashed and the document became unable to be opened. Every time I wanted to open it the same error was:

We’re sorry. We can’t open DocumentName.docx because we found a problem with its contents.
When I want to see Details the following message shows:
Unspecified error
Location: Part: /word/document.xml, Line 2, Column: 0.

Then I wanted to open auto-saved version of the document, the same error appeared. So I changed the DocumentName.docx  file in to DocumentName.zip, and extract the content, found document.xml file and opened it in Notepad++.

The picture below shows the content of the DocumentName.docx file, renamed in to zip and extracted:

Word2013_error2

If you didn’t know the word document with doc or docx extension is actually zip file, which you can extract.

I have opened the docuemnt.xml and try to find error in second line. This was mission impossible because all xml content is placed in this line. As you can see on the picture below:

Word2013_error3

To find which element cause the content problem we have to format XML content. I prefer using Notepad++ and XML Tool PlugIn. It can be installed through Plungins menu of Notepad++.

Word2013_error4

To format xml content choose option Pretty print (XML only – with line breaks) . After the content is formatted, back the Document.xml to zip, change the extension from zip to docx, and open the word document.

The same error appear, but when you choose for details you can read in which line is the error. Find the line in Notepad++ and delete whole tag element:

Word2013_error7

Copy document.xml back in to zip file, rename the extension and try to open. If you have another error, repeat the process again, otherwise your document is opened.

Word2013_error8

Like this post? Please share to your friends:
  • Error printing from word
  • Error opening word document
  • Error numbers in excel
  • Error microsoft office interop excel
  • Error in loading dll in excel vba