From 4e65fa5a5d8e3aa6bade67043a426022dcd780c5 Mon Sep 17 00:00:00 2001 From: koldo Date: Mon, 11 Jul 2011 20:58:43 +0000 Subject: [PATCH] .OfficeAutomation: Added GetText. git-svn-id: svn://ultimatepp.org/upp/trunk@3645 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/OfficeAutomation/OfficeAutomation.cpp | 92 +++++++++++++++++++ .../OfficeAutomation/OfficeAutomationBase.h | 1 + .../OfficeAutomationMethods.h | 4 + bazaar/OfficeAutomation/OfficeSheet.cpp | 12 +++ 4 files changed, 109 insertions(+) diff --git a/bazaar/OfficeAutomation/OfficeAutomation.cpp b/bazaar/OfficeAutomation/OfficeAutomation.cpp index 85bb29815..7939f2c26 100644 --- a/bazaar/OfficeAutomation/OfficeAutomation.cpp +++ b/bazaar/OfficeAutomation/OfficeAutomation.cpp @@ -378,6 +378,15 @@ ObjectOle Ole::MethodGet(ObjectOle from, String which, VariantOle &value, Varian return result.pdispVal; } +ObjectOle Ole::MethodGet(ObjectOle from, String which, VariantOle &value, VariantOle &value2, VariantOle &value3, VariantOle &value4, VariantOle &value5) { + VARIANT result; + VariantInit(&result); + if(!Ole::Invoke(DISPATCH_METHOD, &result, from, which, 4, value.var, value2.var, value3.var, value4.var, value5.var)) + return NULL; + else + return result.pdispVal; +} + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// INITBLOCK { @@ -597,6 +606,50 @@ Value MSSheet::GetValue(String cell) { return GetValue(col, row); } +Value MSSheet::GetText(String cell) { + int row, col; + + OfficeSheet::CellToColRow(cell, col, row); + return GetText(col, row); +} + +// cell in textual format like "B14" +bool MSSheet::SetHyperlink(String cell, String address, String value) { + int col, row; + + OfficeSheet::CellToColRow(cell, col, row); + return MSSheet::SetValue(col, row, value); +} + +bool MSSheet::SetHyperlink(int col, int row, String address, String value) { + if (!Sheet) + return false; + + if (!Select(col, row, col, row)) + return false; + + return SetHyperlink(address, value); +} + +bool MSSheet::SetHyperlink(String address, String value) { + if (!Sheet) + return false; + + if (!Range) + return false; + + ObjectOle hyperlinks = Ole::GetObject(Sheet, "Hyperlinks"); + + VariantOle textToDisplay, screenTip, subAddress, saddress, range; + textToDisplay.BString(value); + screenTip.BString(""); + subAddress.BString(""); + saddress.BString(address); + range.ObjectOle(Range); + + return Ole::MethodGet(hyperlinks, "Add", textToDisplay, screenTip, subAddress, saddress, range); +} + bool MSSheet::SaveAs(String fileName, String type) { if (!Book) return false; @@ -1711,6 +1764,13 @@ Value OPENSheet::GetValue(String cell) { return GetValue(col, row); } +Value OPENSheet::GetText(String cell) { + int row, col; + + OfficeSheet::CellToColRow(cell, col, row); + return GetText(col, row); +} + bool OPENSheet::SaveAs(String fileName, String type) { if (!Document) return false; @@ -1794,6 +1854,38 @@ bool OPENSheet::SetValue(Value value) { return Ole::Method(Range, "setValue", vText); } +bool OPENSheet::SetHyperlink(String cell, String address, String text) { // cell in textual format like "B14" + int col, row; + OfficeSheet::CellToColRow(cell, col, row); + return SetHyperlink(col, row, address, text); +} + +bool OPENSheet::SetHyperlink(int col, int row, String address, String text) { +/* if (!SelCell(col, row)) + return false; + VariantOle vText; + vText.Value(value); + if (value.Is() || value.Is() || value.Is