I am using the python https://github.com/mikemaccana/python-docx module and I am trying to just simply add the degree symbol to my word document and can not see how to do it.
Just have a string something like this:
Degree = "some_numberº"
and then I want to insert that string in my document.
I have created an empty document with the following text inside it:
This is a link documenting the structure of a word document 'of information purposes) : https://stackoverflow.com/tags/docx/info
Here's the content of the document.xml for the specific file with degrees inside:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document mc:Ignorable="w14 wp14" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<w:body>
<w:p w:rsidR="009565D8" w:rsidRDefault="00986522">
<w:r>
<w:rPr>
<w:rFonts w:ascii="Arial" w:cs="Arial" w:hAnsi="Arial"/>
<w:color w:val="000000"/>
<w:sz w:val="21"/>
<w:szCs w:val="21"/>
<w:shd w:color="auto" w:fill="FFFFFF" w:val="clear"/>
</w:rPr>
<w:t>12</w:t>
</w:r>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Arial" w:cs="Arial" w:hAnsi="Arial"/>
<w:color w:val="000000"/>
<w:sz w:val="21"/>
<w:szCs w:val="21"/>
<w:shd w:color="auto" w:fill="FFFFFF" w:val="clear"/>
</w:rPr>
<w:t>º</w:t>
</w:r>
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:bookmarkEnd w:id="0"/>
</w:p>
<w:sectPr w:rsidR="009565D8">
<w:pgSz w:h="16838" w:w="11906"/>
<w:pgMar w:bottom="1417" w:footer="708" w:gutter="0" w:header="708" w:left="1417" w:right="1417" w:top="1417"/>
<w:cols w:space="708"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>
As you can see, they are tags: <w:t></w:t>
. These tags contain the text of your document. One of them contains 12 , and the other contains the degree symbol.
So it is just stored as º
, or charCode 186. To include your string, replace the charactercode of the degree in the string by the characterCode 186, it should work (with a regex for example)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.