1)
{
sXML += " rowspan=\"" + SpanR[iR, iC] + "\"";
}
if (SpanC[iR, iC] > 1)
{
sXML += " colspan=\"" + SpanC[iR, iC] + "\"";
offset += SpanC[iR, iC] - 1;
}
else if (Wcol[iC] > 0)
{
sXML += " width=\"" + Wcol[iC] + "\"";
Wcol[iC] = Wcol[iC] * -1;
}
string textalign = "";
string ha;
switch (myCell.Range.ParagraphFormat.Alignment)
{
case LBWdParagraphAlignment.wdAlignParagraphCenter:
textalign += "Center";
ha = "\\qc";
break;
case LBWdParagraphAlignment.wdAlignParagraphRight:
textalign += "Right";
ha = "\\qr";
break;
default:
textalign += "Left";
ha = "\\ql";
break;
}
switch (myCell.VerticalAlignment)
{
case LBWdCellVerticalAlignment.wdCellAlignVerticalBottom:
textalign += "Bottom";
break;
case LBWdCellVerticalAlignment.wdCellAlignVerticalCenter:
textalign += "Center";
break;
case default(LBWdCellVerticalAlignment):
textalign += "Top";
break;
}
sXML += " textalign=\"" + textalign + "\"";
sXML += ">";
// select text from current cell
_WordApp.Selection.Start = myCell.Range.Start;
_WordApp.Selection.SelectCell();
_WordApp.Selection.End = _WordApp.Selection.End - 1;
if (_WordApp.Selection.End > _WordApp.Selection.Start)
{
// capture formatted text
StepRTB rtbStep = new StepRTB();
_WordApp.Selection.Copy();
rtbStep.Paste();
rtbStep.SelectAll();
Console.WriteLine("RTF before {0}", rtbStep.Rtf);
Console.WriteLine("RTF after {0}", rtbStep.Rtf);
// rtbStep.Rtf.Replace("\\f1 P\\f0 ", "\\u10004?"); // check mark within parenthesis
string strp = rtbStep.Rtf.Replace("\\par\r\n", "!!!");
strp = DisplayText.StaticStripRtfCommands(strp, true);
Console.WriteLine("RTF clean {0}", strp);
strp = strp.Remove(strp.LastIndexOf("!!!"));
StringBuilder sb = new StringBuilder();
sb.Append(strp);
sb.Replace("!!!", "\\par");
// clean up special characters
{
sb.Replace("\x1D", "-");// Hyphen
sb.Replace("\x1E", "-");// Hyphen
sb.Replace("\x2013", "-");// Hyphen
sb.Replace("\xa0", " ");// Space
sb.Replace("\x0b", " ");// Space Soft Return
sb.Replace("\x201C", "\"");// Space
sb.Replace("\x201D", "\"");// Space
sb.Replace("\x09INITIAL", "");// Space
sb.Replace("\x09_____", ""); // Tab Signoff
//sb.Replace("(P)", "(\\u10004?)"); // check mark within parenthesis
//sb.Replace("\\u9633?", "□"); //box
}
// save resulting text in xml structure
sXML += " " + ha + sb + " | ";
}
else
{
sXML += "";
}
}
if (iR >= 0)
{
// at least one row hase been written so close the last row
sXML += "