Hi
Please check the following code:
public ref class Table
{
protected:
array^ Cells;
int columns;
int rows;
public:
void LoadFromFile(String ^WordDocName);
…
};
…
void Table::LoadFromFile(String^ WordDocName)
{
Words::Document ^doc=gcnew Words::Document(WordDocName);
Words::NodeCollection ^tables=doc->GetChildNodes(Words::NodeType::Table,true,false);
if(tables->Count)
{
Words::Tables::Table ^tab=safe_cast(tables[0]);
rows=tab->Rows->Count;
columns=tab->Rows[0]->Cells->Count;
Cells=gcnew array(rows,columns);
int j;
String ^CellText;
for(int i=0;i
for(j=0;j<columns;++j)
{
CellText=tab->Rows[i]->Cells[j]->ToTxt();
Cells[i,j]=gcnew Cell(CellText->Remove(CellText->Length-2));
}
}
else
throw gcnew Exception("Файл не содержит таблиц!");
}
it loads the table from majority of .doc files but doesn’t work with long file (1 MB) that consist of one long table.
Best regards,
Dmitriy