Skip to content

Commit 81e48b9

Browse files
Fix normalization of SectionProperties
1 parent b977f6e commit 81e48b9

17 files changed

+42
-26
lines changed

OfficeIMO.VerifyTests/VerifyTestBase.cs

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Globalization;
33
using System.IO;
44
using System.Linq;
@@ -56,8 +56,7 @@ protected static async Task<string> ToVerifyResult(WordprocessingDocument docume
5656
return result.ToString();
5757
}
5858

59-
private static async Task<string> GetVerifyResult(IdPartPair id)
60-
{
59+
private static async Task<string> GetVerifyResult(IdPartPair id) {
6160
if (id.OpenXmlPart.RootElement is null)
6261
return "";
6362

@@ -139,6 +138,23 @@ private static void NormalizeDocument(Document? document) {
139138
i++;
140139
}
141140
}
141+
142+
// Normalize RSID in SectionProperties
143+
i = 1;
144+
foreach (var sectionProperties in document.Descendants<SectionProperties>()) {
145+
if (sectionProperties.RsidRPr != null) {
146+
sectionProperties.RsidRPr = "R" + i.ToString("X8");
147+
i++;
148+
}
149+
if (sectionProperties.RsidR != null) {
150+
sectionProperties.RsidR = "R" + i.ToString("X8");
151+
i++;
152+
}
153+
if (sectionProperties.RsidDel != null) {
154+
sectionProperties.RsidDel = "R" + i.ToString("X8");
155+
i++;
156+
}
157+
}
142158
}
143159

144160
private static void NormalizeCustomFilePropertiesPart(CustomFilePropertiesPart? part) {

OfficeIMO.VerifyTests/Word/verified/AdvancedDocumentTests.AdvancedWordCreate.verified.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@
798798
</w:p>
799799
<w:p>
800800
<w:pPr>
801-
<w:sectPr w:rsidR="A49FFE8E">
801+
<w:sectPr w:rsidR="R00000001">
802802
<w:headerReference w:type="default" r:id="R00000001" />
803803
<w:footerReference w:type="default" r:id="R00000001" />
804804
</w:sectPr>
@@ -819,7 +819,7 @@
819819
</w:p>
820820
<w:p>
821821
<w:pPr>
822-
<w:sectPr w:rsidR="08C4650D">
822+
<w:sectPr w:rsidR="R00000002">
823823
<w:pgSz w:w="16838" w:h="11906" w:orient="landscape" w:code="9" />
824824
</w:sectPr>
825825
</w:pPr>
@@ -889,7 +889,7 @@
889889
</w:p>
890890
</w:sdtContent>
891891
</w:sdt>
892-
<w:sectPr w:rsidR="46730548">
892+
<w:sectPr w:rsidR="R00000003">
893893
<w:pgSz w:w="8391" w:h="11906" w:code="11" />
894894
</w:sectPr>
895895
</w:body>

OfficeIMO.VerifyTests/Word/verified/BasicDocumentTests.BasicEmptyWord.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<!--------------------------------------------------------------------------------------------------------------------->
2424
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14">
2525
<w:body>
26-
<w:sectPr w:rsidR="8BB6B978" />
26+
<w:sectPr w:rsidR="R00000001" />
2727
</w:body>
2828
</w:document>
2929
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BasicDocumentTests.BasicWord.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<w:t xml:space="preserve"> , and we still continue adding more text to existing paragraph.</w:t>
5757
</w:r>
5858
</w:p>
59-
<w:sectPr w:rsidR="10B5A661" />
59+
<w:sectPr w:rsidR="R00000001" />
6060
</w:body>
6161
</w:document>
6262
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BasicDocumentTests.BasicWordWithBreaks.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<w:t xml:space="preserve">Adding paragraph4 with some text and pressing SHIFT+ENTER</w:t>
6060
</w:r>
6161
</w:p>
62-
<w:sectPr w:rsidR="20B22BF0" />
62+
<w:sectPr w:rsidR="R00000001" />
6363
</w:body>
6464
</w:document>
6565
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BasicDocumentTests.BasicWordWithDefaultFontChange.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<w:t xml:space="preserve">INSTRUMENTO PARTICULAR DE CONSTITUIÇÃO DE GARANTIA DE ALIENAÇÃO FIDUCIÁRIA DE IMÓVEL</w:t>
3636
</w:r>
3737
</w:p>
38-
<w:sectPr w:rsidR="91EF5C46" />
38+
<w:sectPr w:rsidR="R00000001" />
3939
</w:body>
4040
</w:document>
4141
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BasicDocumentTests.BasicWordWithDefaultStyleChange.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<w:t xml:space="preserve">Adding paragraph1 with some text and pressing ENTER</w:t>
4040
</w:r>
4141
</w:p>
42-
<w:sectPr w:rsidR="E2BD5CEA" />
42+
<w:sectPr w:rsidR="R00000001" />
4343
</w:body>
4444
</w:document>
4545
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BookmarkTests.BasicWordWithBookmarks.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<w:t xml:space="preserve">Test 5</w:t>
127127
</w:r>
128128
</w:p>
129-
<w:sectPr w:rsidR="554524CF" />
129+
<w:sectPr w:rsidR="R00000001" />
130130
</w:body>
131131
</w:document>
132132
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/BordersAndMarginsTests.BasicPageBorders.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<w:t xml:space="preserve">Section 0</w:t>
3030
</w:r>
3131
</w:p>
32-
<w:sectPr w:rsidR="5BBC8A46">
32+
<w:sectPr w:rsidR="R00000001">
3333
<w:pgBorders>
3434
<w:top w:val="sharksTeeth" w:color="ADFF2F" w:sz="10" />
3535
<w:left w:val="palmsColor" w:color="00FFFF" w:sz="24" w:space="24" />

OfficeIMO.VerifyTests/Word/verified/BordersAndMarginsTests.BasicPageBorders2.verified.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</w:p>
3333
<w:p>
3434
<w:pPr>
35-
<w:sectPr w:rsidR="754681A4">
35+
<w:sectPr w:rsidR="R00000001">
3636
<w:pgBorders w:offsetFrom="page">
3737
<w:top w:val="single" w:color="auto" w:sz="4" w:space="24" />
3838
<w:left w:val="single" w:color="auto" w:sz="4" w:space="24" />
@@ -42,7 +42,7 @@
4242
</w:sectPr>
4343
</w:pPr>
4444
</w:p>
45-
<w:sectPr w:rsidR="AB98B648">
45+
<w:sectPr w:rsidR="R00000002">
4646
<w:pgBorders w:offsetFrom="page">
4747
<w:top w:val="single" w:color="auto" w:sz="4" w:space="24" w:shadow="true" />
4848
<w:left w:val="single" w:color="auto" w:sz="4" w:space="24" w:shadow="true" />

OfficeIMO.VerifyTests/Word/verified/BordersAndMarginsTests.BasicWordMarginsSizes.verified.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</w:p>
3232
<w:p>
3333
<w:pPr>
34-
<w:sectPr w:rsidR="E72C27E7">
34+
<w:sectPr w:rsidR="R00000001">
3535
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0" />
3636
</w:sectPr>
3737
</w:pPr>
@@ -44,7 +44,7 @@
4444
</w:p>
4545
<w:p>
4646
<w:pPr>
47-
<w:sectPr w:rsidR="D49F3386">
47+
<w:sectPr w:rsidR="R00000002">
4848
<w:pgMar w:top="720" w:right="720" w:bottom="720" w:left="720" w:header="720" w:footer="720" w:gutter="0" />
4949
</w:sectPr>
5050
</w:pPr>
@@ -57,7 +57,7 @@
5757
</w:p>
5858
<w:p>
5959
<w:pPr>
60-
<w:sectPr w:rsidR="6AB5CA55">
60+
<w:sectPr w:rsidR="R00000003">
6161
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0" />
6262
</w:sectPr>
6363
</w:pPr>
@@ -70,7 +70,7 @@
7070
</w:p>
7171
<w:p>
7272
<w:pPr>
73-
<w:sectPr w:rsidR="5D5EC6CA">
73+
<w:sectPr w:rsidR="R00000004">
7474
<w:pgMar w:top="1440" w:right="1080" w:bottom="1440" w:left="1080" w:header="720" w:footer="720" w:gutter="0" />
7575
</w:sectPr>
7676
</w:pPr>
@@ -81,7 +81,7 @@
8181
<w:t xml:space="preserve">Section 4</w:t>
8282
</w:r>
8383
</w:p>
84-
<w:sectPr w:rsidR="AE5E2A2E">
84+
<w:sectPr w:rsidR="R00000005">
8585
<w:pgMar w:top="1440" w:right="2880" w:bottom="1440" w:left="2880" w:header="720" w:footer="720" w:gutter="0" />
8686
</w:sectPr>
8787
</w:body>

OfficeIMO.VerifyTests/Word/verified/ChartTests.AddingMultipleCharts.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
</w:drawing>
139139
</w:r>
140140
</w:p>
141-
<w:sectPr w:rsidR="5167B21A" />
141+
<w:sectPr w:rsidR="R00000001" />
142142
</w:body>
143143
</w:document>
144144
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/CommentTests.PlayingWithComments.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<w:t xml:space="preserve">Test Section - another line</w:t>
4646
</w:r>
4747
</w:p>
48-
<w:sectPr w:rsidR="D6B72722" />
48+
<w:sectPr w:rsidR="R00000001" />
4949
</w:body>
5050
</w:document>
5151
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/CoverPageTests.AddingCoverPage.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@
452452
<w:t xml:space="preserve">More on the next page</w:t>
453453
</w:r>
454454
</w:p>
455-
<w:sectPr w:rsidR="E933CD33">
455+
<w:sectPr w:rsidR="R00000001">
456456
<w:pgSz w:w="11906" w:h="16838" w:code="9" />
457457
</w:sectPr>
458458
</w:body>

OfficeIMO.VerifyTests/Word/verified/CoverPageTests.AddingCoverPage2.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
<w:t xml:space="preserve">More on the next page</w:t>
372372
</w:r>
373373
</w:p>
374-
<w:sectPr w:rsidR="4AC8EFE1" />
374+
<w:sectPr w:rsidR="R00000001" />
375375
</w:body>
376376
</w:document>
377377
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/CustomAndBuiltinPropertiesTests.BasicDocumentProperties.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<w:t xml:space="preserve">Basic paragraph</w:t>
3535
</w:r>
3636
</w:p>
37-
<w:sectPr w:rsidR="EBA47D22" />
37+
<w:sectPr w:rsidR="R00000001" />
3838
</w:body>
3939
</w:document>
4040
<!--------------------------------------------------------------------------------------------------------------------->

OfficeIMO.VerifyTests/Word/verified/CustomAndBuiltinPropertiesTests.ValidateDocument.verified.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<w:t xml:space="preserve">Basic paragraph - Page 4</w:t>
3232
</w:r>
3333
</w:p>
34-
<w:sectPr w:rsidR="809E588B" />
34+
<w:sectPr w:rsidR="R00000001" />
3535
</w:body>
3636
</w:document>
3737
<!--------------------------------------------------------------------------------------------------------------------->

0 commit comments

Comments
 (0)