SVN r1083

SVN-Revision: r1083
This commit is contained in:
tdx
2025-12-23 03:08:46 +00:00
parent edf1481bdd
commit e6483dc91e
+12 -7
View File
@@ -71,9 +71,11 @@ namespace Lskj.AutoCreatWord
bool hasMainTemp = false; bool hasMainTemp = false;
try try
{ {
Section firstSection = null;
if (!string.IsNullOrEmpty(mainTempPath) && File.Exists(mainTempPath)) if (!string.IsNullOrEmpty(mainTempPath) && File.Exists(mainTempPath))
{ {
Section mainSection = new Section(document); Section mainSection = new Section(document);
firstSection = mainSection;
//mainSection.PageSetup.DifferentFirstPageHeaderFooter = false; //mainSection.PageSetup.DifferentFirstPageHeaderFooter = false;
document.Sections.Add(mainSection); document.Sections.Add(mainSection);
hasMainTemp = true; hasMainTemp = true;
@@ -183,13 +185,16 @@ namespace Lskj.AutoCreatWord
document.LastSection.PageSetup.PageSize = section.PageSetup.PageSize; document.LastSection.PageSetup.PageSize = section.PageSetup.PageSize;
document.LastSection.PageSetup.Margins = section.PageSetup.Margins; document.LastSection.PageSetup.Margins = section.PageSetup.Margins;
} }
Section mainSection = document.LastSection; Section lastSection = document.LastSection;
if (!moduleId.Equals("yw", StringComparison.OrdinalIgnoreCase)) if (!moduleId.Equals("yw", StringComparison.OrdinalIgnoreCase))
{ {
//CpoyHeaderFooter(section, mainSection, HeaderFooterType.FooterEven); if (firstSection != null)
//CpoyHeaderFooter(section, mainSection, HeaderFooterType.FooterOdd); {
//CpoyHeaderFooter(section, mainSection, HeaderFooterType.HeaderEven); CpoyHeaderFooter(firstSection, section, HeaderFooterType.FooterEven);
//CpoyHeaderFooter(section, mainSection, HeaderFooterType.HeaderOdd); CpoyHeaderFooter(firstSection, section, HeaderFooterType.FooterOdd);
CpoyHeaderFooter(firstSection, section, HeaderFooterType.HeaderEven);
CpoyHeaderFooter(firstSection, section, HeaderFooterType.HeaderOdd);
}
} }
bool isCopying = false; bool isCopying = false;
foreach (DocumentObject obj in section.Body.ChildObjects) foreach (DocumentObject obj in section.Body.ChildObjects)
@@ -207,7 +212,7 @@ namespace Lskj.AutoCreatWord
{ {
DocumentObject documentObject = obj.Clone(); DocumentObject documentObject = obj.Clone();
//将内容添加到可替换模板 //将内容添加到可替换模板
mainSection.Body.ChildObjects.Add(documentObject); lastSection.Body.ChildObjects.Add(documentObject);
} }
} }
} }
@@ -1670,7 +1675,7 @@ namespace Lskj.AutoCreatWord
HeaderFooter headerFooter = sourceSection.HeadersFooters[headerFooterType]; HeaderFooter headerFooter = sourceSection.HeadersFooters[headerFooterType];
if (headerFooter != null && headerFooter.ChildObjects != null && headerFooter.ChildObjects.Count > 0) if (headerFooter != null && headerFooter.ChildObjects != null && headerFooter.ChildObjects.Count > 0)
{ {
targetSection.HeadersFooters[headerFooterType].LinkToPrevious = false; //targetSection.HeadersFooters[headerFooterType].LinkToPrevious = false;
targetSection.HeadersFooters[headerFooterType].ChildObjects.Clear(); targetSection.HeadersFooters[headerFooterType].ChildObjects.Clear();
foreach (DocumentObject obj in headerFooter.ChildObjects) foreach (DocumentObject obj in headerFooter.ChildObjects)
{ {