Export to Excel from Child Table
Export to Excel from Child Table
hi,
I am looking for the sample code for Export to Excel from Child Table .
Note:
which is the format i used for column in the child table have to be export as it is...
Ex: DateTime format like (dd/MM/yyyy , dd-MM-yyyy, ddMMyyyy) must be export,what i showed in Screen
I am looking for the sample code for Export to Excel from Child Table .
Note:
which is the format i used for column in the child table have to be export as it is...
Ex: DateTime format like (dd/MM/yyyy , dd-MM-yyyy, ddMMyyyy) must be export,what i showed in Screen
Re: Export to Excel from Child Table
Code: Select all
!!CB!! 160
Set nError = MTblExportToExcel( hWndForm, MTE_LNG_ENGLISH, String_NULL,
MTE_EXCEL_NEW_INSTANCE|MTE_EXCEL_STRING_COLS_AS_TEXT,
MTE_COL_HEADERS | MTE_SPLIT_ROWS, 0, ROW_MarkDeleted, COL_Visible, 0 )
If nError != 1
Call ErrorBox( 'Not Completed - Error: ' || SalNumberToStrX( nError, 0 ) || 'Please verify that you have downloaded Mtbl ' )
Re: Export to Excel from Child Table
I am using Child Table Control not Mtbl...FRBhote wrote: ↑25 Apr 2020, 09:49Code: Select all
!!CB!! 160 Set nError = MTblExportToExcel( hWndForm, MTE_LNG_ENGLISH, String_NULL, MTE_EXCEL_NEW_INSTANCE|MTE_EXCEL_STRING_COLS_AS_TEXT, MTE_COL_HEADERS | MTE_SPLIT_ROWS, 0, ROW_MarkDeleted, COL_Visible, 0 ) If nError != 1 Call ErrorBox( 'Not Completed - Error: ' || SalNumberToStrX( nError, 0 ) || 'Please verify that you have downloaded Mtbl ' )
-
- Site Admin
- Posts: 463
- Joined: 05 Mar 2017, 20:57
- Location: Stroud, England <--> Tauranga, New Zealand
Re: Export to Excel from Child Table
.
Simple Automation example attached.
Populate the Child Table from any SQL query first .
.
Simple Automation example attached.
Populate the Child Table from any SQL query first .
.
You do not have the required permissions to view the files attached to this post.
Greetings from New Zealand
Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Re: Export to Excel from Child Table
Thanks for your reply..your sample code also having same issue..Steve Leighton wrote: ↑26 Apr 2020, 21:52.
Simple Automation example attached.
Populate the Child Table from any SQL query first .
.
ExportTblToExcel_Automation.zip
what is the issue i am facing in my existing code,
NOTE: discrepancy date format (Populate table and after export excel )
Please Find Attached
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 463
- Joined: 05 Mar 2017, 20:57
- Location: Stroud, England <--> Tauranga, New Zealand
Re: Export to Excel from Child Table
.
Since the dates are being copied into Excel as Text,
you first need to format the Excel Range to be Text also. Otherwise Excel defaults and ( incorrectly ) assumes it is a Date format required.
As soon as the Excel Range is defined, you simply apply a Text format to the whole Range:
this way , Excel acts as if the Text ( Dates in this case ) are being typed in directly and does not apply any other formatting - it just takes whatever is typed ( or copied ) into the cell.
Obviously, if you don't want to apply a Text format to an entire Range, you can apply to just columns or cells - but they require defining first in the same way as the Range is defined.
Revised sample app attached to include the declaration of a variant, and the call to set the entire Range to Text format.
.
Since the dates are being copied into Excel as Text,
you first need to format the Excel Range to be Text also. Otherwise Excel defaults and ( incorrectly ) assumes it is a Date format required.
As soon as the Excel Range is defined, you simply apply a Text format to the whole Range:
Code: Select all
Call vFormat.SetString( '@' )
Call iXRange.PropSetNumberFormat( vFormat )
Obviously, if you don't want to apply a Text format to an entire Range, you can apply to just columns or cells - but they require defining first in the same way as the Range is defined.
Revised sample app attached to include the declaration of a variant, and the call to set the entire Range to Text format.
.
You do not have the required permissions to view the files attached to this post.
Greetings from New Zealand
Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Re: Export to Excel from Child Table
Thanks for your post Mr.Steve Leighton
I got a solution from your sample code..
I got a solution from your sample code..
Who is online
Users browsing this forum: [Ccbot] and 1 guest