Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6787521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:22:34+00:00 2026-05-26T17:22:34+00:00

How can I set the text codification of my open xml document ? In

  • 0

How can I set the text codification of my open xml document ?

In Office 2003, when I open a document that was build through Open XML, a error appears about codification, like that. How can I set the codification or how can I fix this error ?

I have the Compatibility pack installed, and I can open every .docx file, but this one seems that I need set the codification.

How I create the document

private static void BuildDocument(string fileName, List<string> lista, string tipo)
        {     

            using (WordprocessingDocument w = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))
            {                
                MainDocumentPart mp = w.AddMainDocumentPart();
                DocumentFormat.OpenXml.Wordprocessing.Document d = new DocumentFormat.OpenXml.Wordprocessing.Document();
                Body b = new Body();                
                DocumentFormat.OpenXml.Wordprocessing.Paragraph p = new DocumentFormat.OpenXml.Wordprocessing.Paragraph();
                Run r = new Run();
                for (int i = 0; i < lista.Count; i++)
                {
                    Text t = new Text();
                    t.Text = lista[i];

                    if (t.Text == "          ")
                    {
                        r.Append(new CarriageReturn());
                    }
                    else
                    {                        
                        r.Append(t);
                        r.Append(new CarriageReturn());
                    }
                }

                lista.Clear();
                p.Append(r);
                b.Append(p);
                HeaderPart hp = mp.AddNewPart<HeaderPart>();
                string headerRelationshipID = mp.GetIdOfPart(hp);
                SectionProperties sectPr = new SectionProperties();
                HeaderReference headerReference = new HeaderReference();
                headerReference.Id = headerRelationshipID;
                headerReference.Type = HeaderFooterValues.Default;
                sectPr.Append(headerReference);
                b.Append(sectPr);
                d.Append(b);

                hp.Header.Save();
                mp.Document = d;
                mp.Document.Save();
                w.Close();
            }             
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:22:35+00:00Added an answer on May 26, 2026 at 5:22 pm

    Open XML is only for Office documents 2007 and older. Office 2003 and under is not compatible with Open XML and that is why you are getting this popup. This is not controllable through Open XML and only Word will give the popup when you open an incompatible document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Oracle, you can write: update t set xml = updateXML(xml, '/a/b/text()', 'gaga') This
In XML, we can set a text color by the textColor attribute, like android:textColor=#FF0000
Hilfe how can i set the text-style
What is the max size of the multi line text field? Can I set
How can I add a line break to text when it is being set
I can set the relationship between View Model and view through following DataContext syntax:
How can I set text direction [rtl] on load editor?
I have a text area. I can set the text of it with $(#mytextarea).text(foo)
I'm using SearchView widget (new in Honeycomb). I can set initial text by setQuery,
How can I set some text to a label but also store its ID.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.