We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get table from .doc file

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

Hi
Thanks for your request. Most likely you are using Aspose.Words in evaluation mode and your document is truncated. Please see the following link to learn more about restriction of evaluation version of Aspose.Words.
https://docs.aspose.com/words/net/
If you want to test Aspose.Words without the evaluation version limitations, you can request a 30-day Temporary License. Please refer to
https://purchase.aspose.com/temporary-license
Best regards.