SVN r751
SVN-Revision: r751
This commit is contained in:
@@ -144,7 +144,7 @@ namespace Lskj.AutoCreatWord
|
|||||||
TextSelection endSelection = document3.FindString("{" + moduleId + ":end}", false, true);
|
TextSelection endSelection = document3.FindString("{" + moduleId + ":end}", false, true);
|
||||||
if (startSelection != null && endSelection != null)
|
if (startSelection != null && endSelection != null)
|
||||||
{
|
{
|
||||||
if (moduleId.Equals("yw", StringComparison.OrdinalIgnoreCase) || i == 0)
|
if (moduleId.Equals("yw", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Paragraph lastBreakParagraph = null;
|
Paragraph lastBreakParagraph = null;
|
||||||
DocumentObject lastBreak = null;
|
DocumentObject lastBreak = null;
|
||||||
@@ -168,10 +168,6 @@ namespace Lskj.AutoCreatWord
|
|||||||
lastBreakParagraph.ChildObjects.Remove(lastBreak);
|
lastBreakParagraph.ChildObjects.Remove(lastBreak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 0 && document.LastSection.Paragraphs.Count > 0)
|
|
||||||
{
|
|
||||||
//document.LastSection.Paragraphs[document.LastSection.Paragraphs.Count - 1].AppendBreak(BreakType.PageBreak);
|
|
||||||
}
|
|
||||||
Section section = startSelection.GetAsOneRange().OwnerParagraph.OwnerTextBody.Owner as Section;
|
Section section = startSelection.GetAsOneRange().OwnerParagraph.OwnerTextBody.Owner as Section;
|
||||||
if (section.PageSetup.Orientation != document.LastSection.PageSetup.Orientation)
|
if (section.PageSetup.Orientation != document.LastSection.PageSetup.Orientation)
|
||||||
{
|
{
|
||||||
@@ -202,8 +198,9 @@ namespace Lskj.AutoCreatWord
|
|||||||
}
|
}
|
||||||
if (isCopying)
|
if (isCopying)
|
||||||
{
|
{
|
||||||
|
DocumentObject documentObject = obj.Clone();
|
||||||
//将内容添加到可替换模板
|
//将内容添加到可替换模板
|
||||||
mainSection.Body.ChildObjects.Add(obj.Clone());
|
mainSection.Body.ChildObjects.Add(documentObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,26 +494,26 @@ namespace Lskj.AutoCreatWord
|
|||||||
{
|
{
|
||||||
if (tableCell.Paragraphs.Count == 0)
|
if (tableCell.Paragraphs.Count == 0)
|
||||||
{
|
{
|
||||||
if (disMergeDic.ContainsKey(table))
|
//if (disMergeDic.ContainsKey(table))
|
||||||
{
|
//{
|
||||||
disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
// disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
// disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
||||||
}
|
//}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(tableCell.Paragraphs[0].Text))
|
if (string.IsNullOrEmpty(tableCell.Paragraphs[0].Text))
|
||||||
{
|
{
|
||||||
if (disMergeDic.ContainsKey(table))
|
//if (disMergeDic.ContainsKey(table))
|
||||||
{
|
//{
|
||||||
disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
// disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
// disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
||||||
}
|
//}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern, RegexOptions.IgnoreCase) || Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern1, RegexOptions.IgnoreCase))
|
if (Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern, RegexOptions.IgnoreCase) || Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern1, RegexOptions.IgnoreCase))
|
||||||
@@ -773,7 +770,11 @@ namespace Lskj.AutoCreatWord
|
|||||||
TableCell newCell2 = new TableCell(document);
|
TableCell newCell2 = new TableCell(document);
|
||||||
// 设置单元格宽度为原行宽度的一半
|
// 设置单元格宽度为原行宽度的一半
|
||||||
newCell1.SetCellWidth(50, CellWidthType.Percentage);
|
newCell1.SetCellWidth(50, CellWidthType.Percentage);
|
||||||
|
newCell1.CellFormat.BackColor = item.Cells[0].CellFormat.BackColor;
|
||||||
|
newCell1.CellFormat.VerticalAlignment = item.Cells[0].CellFormat.VerticalAlignment;
|
||||||
newCell2.SetCellWidth(50, CellWidthType.Percentage);
|
newCell2.SetCellWidth(50, CellWidthType.Percentage);
|
||||||
|
newCell2.CellFormat.BackColor = item.Cells[0].CellFormat.BackColor;
|
||||||
|
newCell2.CellFormat.VerticalAlignment = item.Cells[0].CellFormat.VerticalAlignment;
|
||||||
newRow.Cells.Clear();
|
newRow.Cells.Clear();
|
||||||
// 将两个新的单元格添加到行中
|
// 将两个新的单元格添加到行中
|
||||||
newRow.Cells.Add(newCell1);
|
newRow.Cells.Add(newCell1);
|
||||||
@@ -934,26 +935,26 @@ namespace Lskj.AutoCreatWord
|
|||||||
{
|
{
|
||||||
if (tableCell.Paragraphs.Count == 0)
|
if (tableCell.Paragraphs.Count == 0)
|
||||||
{
|
{
|
||||||
if (disMergeDic.ContainsKey(table))
|
//if (disMergeDic.ContainsKey(table))
|
||||||
{
|
//{
|
||||||
disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
// disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
// disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
||||||
}
|
//}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(tableCell.Paragraphs[0].Text))
|
if (string.IsNullOrEmpty(tableCell.Paragraphs[0].Text))
|
||||||
{
|
{
|
||||||
if (disMergeDic.ContainsKey(table))
|
//if (disMergeDic.ContainsKey(table))
|
||||||
{
|
//{
|
||||||
disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
// disMergeDic[table].Add(tableRow.Cells.IndexOf(tableCell));
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
// disMergeDic.Add(table, new List<int>() { tableRow.Cells.IndexOf(tableCell) });
|
||||||
}
|
//}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern, RegexOptions.IgnoreCase) || Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern1, RegexOptions.IgnoreCase))
|
if (Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern, RegexOptions.IgnoreCase) || Regex.IsMatch(tableCell.Paragraphs[0].Text, pattern1, RegexOptions.IgnoreCase))
|
||||||
@@ -1215,7 +1216,11 @@ namespace Lskj.AutoCreatWord
|
|||||||
TableCell newCell1 = new TableCell(document);
|
TableCell newCell1 = new TableCell(document);
|
||||||
TableCell newCell2 = new TableCell(document);
|
TableCell newCell2 = new TableCell(document);
|
||||||
newCell1.SetCellWidth(50, CellWidthType.Percentage);
|
newCell1.SetCellWidth(50, CellWidthType.Percentage);
|
||||||
|
newCell1.CellFormat.BackColor = item.Cells[0].CellFormat.BackColor;
|
||||||
|
newCell1.CellFormat.VerticalAlignment = item.Cells[0].CellFormat.VerticalAlignment;
|
||||||
newCell2.SetCellWidth(50, CellWidthType.Percentage);
|
newCell2.SetCellWidth(50, CellWidthType.Percentage);
|
||||||
|
newCell2.CellFormat.BackColor = item.Cells[0].CellFormat.BackColor;
|
||||||
|
newCell2.CellFormat.VerticalAlignment = item.Cells[0].CellFormat.VerticalAlignment;
|
||||||
newRow.Cells.Clear();
|
newRow.Cells.Clear();
|
||||||
// 将两个新的单元格添加到行中
|
// 将两个新的单元格添加到行中
|
||||||
newRow.Cells.Add(newCell1);
|
newRow.Cells.Add(newCell1);
|
||||||
@@ -1593,7 +1598,7 @@ namespace Lskj.AutoCreatWord
|
|||||||
private static void CpoyHeaderFooter(Section sourceSection, Section targetSection, HeaderFooterType headerFooterType)
|
private static void CpoyHeaderFooter(Section sourceSection, Section targetSection, HeaderFooterType headerFooterType)
|
||||||
{
|
{
|
||||||
HeaderFooter headerFooter = sourceSection.HeadersFooters[headerFooterType];
|
HeaderFooter headerFooter = sourceSection.HeadersFooters[headerFooterType];
|
||||||
if (headerFooter != null && headerFooter.ChildObjects != null)
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user