Re: Editable tables and general planning help
| From: | Gonzalo Monzón | Date: | Mon, 11 Jul 2005 05:58:19 +0000 |
| Subject: | Re: Editable tables and general planning help | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5942@lists.php.net to get a copy of this message | ||
Hi all,
Did somebody test the Tom's php_win32api extension over PHP4?
I'm running php.4.3.9 and I got an error when loading the extension, something like "the procedure 'ap_php_snprintf' is missing in the php4ts.dll dynamic link library" -the error message is in spanish-.
For what php version did you compile the extension?
Regards,
Gonzalo
Tom Rogers escribió:
Hi,
Friday, July 8, 2005, 9:59:08 PM, you wrote:
JG> These responses I've been getting are fantastic! Thank you all!
JG> One area which I haven't seen a response to yet is with *copying and
JG> pasting*. Say I'm using a gtksheet (which now seems like the most JG> sensible solution), and I want to copy and paste data from and to an
JG> Excel spreadsheet into *multiple cells*, how should this be done?
JG> Using GtkSheet I can select a row or a column or a group of cells in a
JG> row or column, but I don't seem to be able to either copy from there or
JG> paste into there using CTR-V or CTR-C.
JG> Has anyone achieved this? I tried searching the mailing list archive but
JG> can't find any answers to this one.
JG> e.g. I may have an Excel spreadsheet with 50 cells in one column which i
JG> want to paste into a GtkSheet. The desired way of doing this would be to
JG> copy from excel and then select one cell in GtkSheet and CTR-V and it'll
JG> paste into that cell and the 49 cells directly below it, in the same way
JG> that it would in Excel or other spreadsheets.
JG> Jake.
I have been playing with pasting from word documents in html format so
I can give you what I have done modified for the excel->sheet bit.
You will need my version of win32api.dll which you can download from:
http://kwiktemplates.com/php_w32api.dll
This code will grab the excel data as csv text and turn it into an
array, after that it should be easy to add it to your sheet. The other
direction will take a bit more research :)
<?php
dl("php_w32api.dll");
$api =& new win32;
$api->registerfunction("bool OpenClipboard
(
long hWndNewOwner
)
From user32.dll");
$api->registerfunction("bool CloseClipboard
(
)
From user32.dll");
$api->registerfunction("int EnumClipboardFormats
(
int format
)
From user32.dll");
$api->registerfunction("int GetClipboardFormatName
(
int format,
string &FormatName,
int cchMaxCount
)
From user32.dll");
$api->registerfunction("long GetClipboardData
(
int uFormat
)
From user32.dll");
$api->registerfunction("string GlobalLock
(
long hMem
)
From kernel32.dll");
$api->registerfunction("bool GlobalUnlock
(
long hMem
)
From kernel32.dll");
$NameSize = 128; //maxsize for returned name
// get a clipboard id
$id = $api->OpenClipboard('');
if($id){
$fn = $api->EnumClipboardFormats(0);
do {
$name = str_repeat("\0", $NameSize); //zero the name holder
$api->GetClipboardFormatName($fn,$name,$NameSize);
if(preg_match('/CSV/i',$name)){
$data_handle = $api->GetClipboardData($fn);
if($data_handle){
$text = trim($api->GlobalLock($data_handle));
echo $text;
$rows = explode("\r\n",$text);
foreach($rows as $key=>$row){
$rows[$key] = explode(',',$row); //add columns
}
print_r($rows);
$api->GlobalUnlock($data_handle);
}
break;
}
//echo "Fn $fn $name\n";
}while($fn = $api->EnumClipboardFormats($fn));
$api->CloseClipboard();
}
?>
To test copy some cells to the clipboard then run this script.
Maybe someone knows how to manipulate the gtk clipboard to achieve the
above ?