private Word.Table find_Textline_Create_Empty_Table(string sHeader)
{
//-----------------< find_Table_with_Header() >-----------------
//--< find Table Header >--
//*Loop all tables and look for header
foreach (Word.Range sLine in _doc.Sentences)
{
//-------< Check Sentence >------
string sText = sLine.Text;
sText = sText.Trim();
if (sText == sHeader )
{
//----< Line_found >----
sLine.InsertAfter("\r\r");
sLine.Select();
_app.Selection.EndKey();
_app.Selection.Select();
Range newRange = _app.Selection.Range;
_app.ScreenRefresh();
//< init setup >
int Columns_Count = Settings1.Default.Columns_Count;
//</ init setup >
//< create new table >
//Word.Range newRange = sLine.MoveEnd(WdUnits.wdCharacter, -1);
Word.Table newTable = _doc.Tables.Add( newRange ,NumRows:1,NumColumns: Columns_Count);
newTable.Borders.InsideColor = WdColor.wdColorRed;
//</ create new table >
//< out >
return newTable;
//</ out >
//----</ Line_found >----
}
//-------</ Check Sentence >------
}
//< check >
System.Windows.Forms.MessageBox.Show("Zeile nicht gefunden. " + Environment.NewLine + "gesuchter Header:" + sHeader, "Header nicht gefunden");
return null;
//--</ find Table Header >--
//-----------------</ find_Table_with_Header() >-----------------
}
|