Nhiệm vụ của tôi là đặt nhận xét qua API Javascript Office trong tài liệu Word (.docx) tương thích với Word 2007 trở lên.Đặt nhận xét qua API Javascript của Office 1.1
Tôi thấy rằng có không có cách trực tiếp để thực hiện việc này thông qua Microsoft API.
Vì tôi có thể chuyển OOXML sang tài liệu Word, tôi nghĩ rằng tôi có thể sử dụng điều này để đặt nhận xét.
Tôi đã thực hiện một số nghiên cứu về cấu trúc tài liệu Word và các nhận xét được lưu trữ trong một tệp XML riêng biệt gọi là "comments.xml" và sau đó được tham chiếu qua ID trong "document.xml" (tôi đính kèm một mẫu tương ứng).
Có cách nào để chỉnh sửa số này comments.xml
qua API để đặt nhận xét trong tài liệu Word hay không không phải là có thể?
mẫu "document.xml":
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
mc:Ignorable="w14 wp14">
<w:body>
<w:p w:rsidR="00A9590C" w:rsidRDefault="0058668B">
<w:r>
<w:t>I am text.</w:t>
</w:r>
</w:p>
<w:p w:rsidR="0058668B" w:rsidRDefault="0058668B">
<w:commentRangeStart w:id="0"/>
<w:r>
<w:t>I am text with comment.</w:t>
</w:r>
<w:commentRangeEnd w:id="0"/>
<w:r>
<w:rPr>
<w:rStyle w:val="Kommentarzeichen"/>
</w:rPr>
<w:commentReference w:id="0"/>
</w:r>
</w:p>
<w:sectPr w:rsidR="0058668B">
<w:pgSz w:w="11906" w:h="16838"/>
<w:pgMar w:top="1417" w:right="1417" w:bottom="1134" w:left="1417" w:header="708" w:footer="708"
w:gutter="0"/>
<w:cols w:space="708"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
mẫu "comments.xml":
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:comments
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
mc:Ignorable="w14 wp14">
<w:comment w:id="0" w:author="rz" w:date="2015-05-23T10:30:00Z" w:initials="r">
<w:p w:rsidR="0058668B" w:rsidRDefault="0058668B">
<w:pPr>
<w:pStyle w:val="Kommentartext"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rStyle w:val="Kommentarzeichen"/>
</w:rPr>
<w:annotationRef/>
</w:r>
<w:r>
<w:t>Test</w:t>
</w:r>
<w:bookmarkStart w:id="1" w:name="_GoBack"/>
<w:bookmarkEnd w:id="1"/>
</w:p>
</w:comment>
</w:comments>