Ejemplo n.º 1
0
int Sampler::SampleWord(int doc, int index) {
  PrepareWord(doc, index);
  return SampleWordTopic(doc, index);
}
Ejemplo n.º 2
0
//---------------------------------------------------------------------------
void __fastcall TRefEditForm::Button_Click(TObject *Sender)
{

  wchar_t	*doc_contents;
  wchar_t	*ref_contents;
  wchar_t	*ref_codes;
  RangePtr	my_range;
  OleVariant	FileName;
  
  PrepareWord();

  if(OpenDialog1->Execute())
  { ref_fileName = OpenDialog1->FileName;
    FileName = ref_fileName;
    WordDocument1->ConnectTo(WordApplication1->Documents->Open(FileName));

    TablesPtr doc_tables;
              doc_tables=WordDocument1->Tables;
    Table* ref_table;
           ref_table=doc_tables->Item(1);
    Columns* ref_table_columns;
             ref_table_columns=ref_table->get_Columns();
    Column* ref_column;
            ref_column=ref_table_columns->get_First();
    Cells* cells;
           cells=ref_column->Cells;
    ref_count=cells->get_Count();

    Cell* cell;

    arr=new TRefCod2RefNo[ref_count];
    RangePtr  ref_range;
    for(long j=0;j<ref_count;j++)
                { cell=cells->Item(j+1);
                  ref_range=cell->get_Range();
                  ref_contents =ref_range->get_Text();
                  wcsncpy(arr[j].RefCode, ref_contents, 4);
                  arr[j].RefCode[4]='\0';
                  arr[j].RefNo=j+1;
                  arr[j].used=0;
                }
//    ref_sort(arr, ref_count);
    WordDocument1->Close();
    WordDocument1->Disconnect();
  }
/*
        ref_count=WordDocument1->Tables->Item(1)->get_Columns()->get_First()->Cells->get_Count();
        Cell* cell;
        arr=new TRefCod2RefNo[ref_count];
        for(long j=0;j<ref_count;j++)
        { cell=WordDocument1->Tables->Item(1)->get_Columns()->get_First()->Cells->Item(j+1);
          wcsncpy(arr[j].RefCode, cell->get_Range()->get_Text(), 4);
          arr[j].RefCode[4]='\0';
          arr[j].RefNo=j+1;
        }
         ListBox1->Items->Clear();
         ListBox2->Items->Clear();
         for(long j=0;j<ref_count;j++)
        {
         ListBox1->Items->Append((AnsiString)arr[j].RefCode);
         ListBox2->Items->Append(IntToStr(arr[j].RefNo));
        }
*/
}