Example in VB
Download Now
FAQ'S
Buy It Now
Example
in ASP:
<%
'Create the
convert word to text object
set w2t = Server.CreateObject("W2TServer.W2T")
'VerifyLicense verify the username/keycode of word to text converter.
'it always success in trial version.
w2t.VerifyLicense "4747457", "345srwr242342423"
Response.Write w2t.Convert ("c:\test\test1.doc", "c:\box\test1.txt")+
"<br>"
Response.Write w2t.Convert ("c:\test\test2.doc", "c:\box\test2.txt") +
"<br>"
Response.Write w2t.Convert2Mem ("c:\test\test3.doc", 50000) +
"<br>"
%>
Go back to top
Example
in PHP:
<?php
#Create
word to text object
$w2t = new COM("W2TServer.W2T");
#VerifyLicense
always success in trial version.
$w2t->VerifyLicense("4747457", "345srwr242342423");
#Convert word file
to text file
print
$w2t->Convert ("c:\test\test1.doc", "c:\box\test1.txt"). "<br>";
print $w2t->Convert ("c:\test\test2.doc", "c:\box\test2.txt"). "<br>";
print $w2t->Convert2Mem ("c:\test\test3.doc", 50000). "<br>";
#Release
word to text object.
$w2t = null;
?>
Go back to
top
Example in ColdFusion:
<cfobject type="COM"
action="Create"
name="w2t"
class="W2TServer.W2T">
<cfset strName="4747457">
<cfset strKey="345srwr242342423">
<cfset result = w2t.VerifyLicense(strName, strKey)>
<cfset strWordName="C:\test\test1.doc">
<cfset strTXTName="C:\test\test1.txt">
<cfset result=w2t.Convert(strWordName, strTXTName)>
<cfset result=w2t.Convert2Mem(strWordName, 50000)>
Go back to
top
Example in VC:
You need generate wrapper class of word to text converter use class wizard first.
"ClassWizard->ActiveX Events->Add Class->From a type lib..."
////////////////////////////////
IW2T w2t;
if(w2t.CreateDispatch("W2TServer.W2T"))
{
w2t.VerifyLicense("34234","234234");
CString strRslt = w2t.Convert("C:\\test\\test1.doc","c:\\test\\test1.txt");
MessageBox(LPCTSTR(strRslt));
strRslt = w2t.Convert2Mem("C:\\test\\test2.doc",5000);
MessageBox(LPCTSTR(strRslt));
}
/////////////////////////////////
Go back to top
Example in VB:
You need to add the reference of Word to Text Converter to the project
"Project->References..." Make sure "W2TServer Type Library" was selected
there.
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim myW2T As W2TSERVERLib.W2T
Dim strRslt As String
'Create the Word to text object
Set myW2T = New W2T
'Verify the
license information of Excel to text Converter.
myW2T.VerifyLicense "234234", "23423432"
'Convert
Word file to Text File.
strRslt = myW2T.Convert(C:\test\test1.doc","c:\test\test1.txt")
MsgBox strRslt
strRslt = myW2T.Convert2Mem(C:\test\test2.doc",5000)
MsgBox strRslt
'''''''''''''''''''''''''''''''''''''''''''''''''
Go back to top
Any comments or question, Send email to
support@retsinasoftware.com with "W2TCOM" in subject.
COM Interface
There's 4 methods exposed
///////////////////////////////////////////////////////
1. HRESULT VerifyLicense(
[in] BSTR bstrName,
[in] BSTR bstrKey,
[out, retval] long* pbRetVal);
VerifyLicense is the method must be called before all other methods.
It's to verify the run time license information.
@param BSTR bstrName: The register name
@param BSTR bstrKey: The register key code.
@param long* pbRetVal: 1 If verify license cuccessfully.
0 If something wrong with the name/key
This variable always be set to 1 in trial version
@return S_OK
///////////////////////////////////////////////////////
2. HRESULT GetVersion([out, retval] BSTR* pbstrVersion);
Return the
version information.
@param BSTR*
pbstrVersion: The current version information was returned in this buffer.
@return S_OK
///////////////////////////////////////////////////////
3. HRESULT Convert(
[in] BSTR bstrWord,
[in] BSTR bstrTXT,
[out, retval] BSTR* pbstrRetVal);
@param BSTR bstrWord: The absolute path and file name of the word file
you
want to convert.
@param BSTR bstrTXT: The absolute path and file name of the text file
you
want to convert to.
@param BSTR* pbstrRetVal: The result and any warning/error
information
will return by this pointer
@return S_OK: Process the excel file successfully. Check *pbstrRetVal
for detail
information.
///////////////////////////////////////////////////////
4. HRESULT Convert2Mem(
[in] BSTR bstrWord,
[in] int nBufSize,,
[out, retval] BSTR* pbstrRetVal);
@param BSTR bstrWord: The absolute path and file name of the word file you want to convert.
@param BSTR nBufSize: The data buffer size for the output data, if the output data size is bigger than the buffer size, the converter just discard the overflowed data. There's a hard code limitation of buffer size, it's 5M, if pass in nBufSize is bigger than 5M, the converter will set the buffer size to 5M.
@param BSTR* pbstrRetVal: The converted text will be return directly in the variable.
@return S_OK: Process the word file successfully. If it's not S_OK, check *pbstrRetVal for detail information.
Go back to top