Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Variant word = CreateOleObject("Word.Application");
  2. word.OlePropertySet("Visible", "true");
  3.  
  4. long row = CSpinEdit1->Value;
  5. long column = CSpinEdit2->Value;
  6.  
  7. Variant docs = word.OlePropertyGet("Documents");
  8. Variant doc = docs.OleFunction("Open",fileName);
  9.  
  10. Variant tables = doc.OlePropertyGet("Tables");
  11. int tablesCount = tables.OlePropertyGet("Count");
  12. for (int i = 1; i <= tablesCount; ++i) {
  13. Variant table = tables.OleFunction("Item", i);
  14. if (row <= (long)table.OlePropertyGet("Rows").OlePropertyGet("Count") &&
  15. column < (long)table.OlePropertyGet("Columns").OlePropertyGet("Count")) {
  16. Variant cell = table.OleFunction("Cell", row, column);
  17. cell.OleFunction("Merge", table.OleFunction("Cell", row, column + 1));
  18. }
  19. }
  20. doc.OleFunction("Save");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement