Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Excel and leading zeros

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Excel and leading zeros
 Login/Join
 
Silver Member
posted
Hi,
The output of my report is Excel and in order to format it for printing (landscape, borders, etc) I used the HTMLFORM approach (trying to steer away from templates...). One of my output columns is strings, but some values can be numbers only, for example 001234. If I just output to Excel (ON TABLE PCHOLD FORMAT EXL2K) everything looks ok, the leading zeros appear. Once I change to output to use the HTMLFORM, the leading zeros are dropped.

Any ideas of how I can make sure I get those zeros?
Thanks,
Luminita

Here is the HTMLFORM code I use.
 -HTMLFORM BEGIN
<html xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 <head>
 <meta http-equiv=Content-Type content="text/html;">
 <meta name=ProgId content=Excel.Sheet>
 <meta name=Generator content="Microsoft Excel 10">
 <!--[if gte mso 9]><xml>
  <o:OfficeDocumentSettings>
-*  <o:ReadOnlyRecommended/>
  <o:DownloadComponents/>
  <o:LocationOfComponents HRef=3D"file:///\\"/>
  </o:OfficeDocumentSettings>
 </xml><![endif]-->
<style>
<!--table
	{
	mso-displayed-decimal-separator:"\x";
	mso-number-format:"\.00";
	mso-displayed-thousand-separator:"\,";}
@page
	{mso-footer-data : '&|L Date: &|D Time: &|T &|C Fidelity Confidential Information &|R Page &|P of &|N';
	margin:.5in .25in .5in .25in;
	mso-header-margin:.25in;
	mso-footer-margin:.25in;
	mso-page-orientation:landscape;
	mso-horizontal-page-align:center; padding-top:0px;
	mso-number-format:"\#\#\,\#\#0\.00";}
-->
	</style>
<!--[if gte mso 9]><xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>ExceptionReport</x:Name>
    <x:WorksheetOptions>
    <x:FitToPage/>
     <x:Print>
           <x:FitWidth>1</x:FitWidth>
           <x:FitHeight>99</x:FitHeight>
      <x:ValidPrinterInfo/>
      <x:Scale>80</x:Scale>
      <x:HorizontalResolution>600</x:HorizontalResolution>
      <x:VerticalResolution>600</x:VerticalResolution>
    </x:Print>
    <x:PageBreakZoom>100</x:PageBreakZoom>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
    </x:WorksheetOptions>
-*    <x:PageBreaks>
-*     <x:RowBreaks>0</x:RowBreaks>
-*    </x:PageBreaks>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:AcceptLabelsInFormulas/>
 <x:WindowHeight>11535</x:WindowHeight>
 <x:WindowWidth>19140</x:WindowWidth>
 <x:WindowTopX>120</x:WindowTopX>
 <x:WindowTopY>120</x:WindowTopY>
 </x:ExcelWorkbook>
-* <Styles>
-*	   <Style ss:ID="A">
-*	     <NumberFormat ss:Format="@" />
-*	   <Style>
-* <Styles>
 <x:SupBook>
   <x:Path>ExceptionReport</x:Path>
   <x:SheetName>ExceptionReport</x:SheetName>
  </x:SupBook>
</xml>
</head>
!IBI.FIL.NTF_OUT;
-HTMLFORM END
 

This message has been edited. Last edited by: Luminita,


7.6.6 on AIX platform
Output: variety (Excel, HTML and PDF)
 
Posts: 33 | Location: New Hampshire | Registered: October 17, 2007Report This Post
Expert
posted Hide Post
I've never seen code like this used inside an HTMLFORM. How did you come up with this?

Since you're using this type of code, can't you address a specific column and use styling to change the number format? Or is the number format code (NumberFormat ss:Format="@") removing the leading zeros?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Master
posted Hide Post
Hope this helps.
DEFINE FILE CAR
DEF_COL_A/A20=IF COUNTRY EQ 'ENGLAND' THEN '001234' ELSE IF COUNTRY EQ 'ITALY' THEN '004231' ELSE '12346687';
END
TABLE FILE CAR
PRINT
DEF_COL_A
COMPUTE COM_COL_A/A20=IF COUNTRY EQ 'ENGLAND' THEN '001234 ' ELSE IF COUNTRY EQ 'ITALY' THEN '004231 ' ELSE '12346687 ';
CAR
COUNTRY
ON TABLE HOLD AS HLD_1 FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,COLUMN=N1,CLASS=NUMASTEXT,$
TYPE=DATA,COLUMN=N2,CLASS=NUMASNUM,$
ENDSTYLE
END


SET HTMLFORMTYPE=XLS
-HTMLFORM BEGIN
<html xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 <head>
 <meta http-equiv=Content-Type content="text/html;">
 <meta name=ProgId content=Excel.Sheet>
 <meta name=Generator content="Microsoft Excel 10">
<style>
TD.NUMASTEXT
{mso-number-format:\@}
TD.NUMASNUM
{mso-number-format:\#\,\#\#0\.00}
</style>
</head>
<body>
<table>
<tr>
<td class="accountnum">
!IBI.FIL.HLD_1;
</td>
</tr></table>
</body>
-HTMLFORM END
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Report This Post
Silver Member
posted Hide Post
Prasad, Thank you so much, that worked like a charm! I am having a hard time finding help documents for stuff like this, any tips or tricks on how to go about that?


Francis, I sort of "inherited" this code from other developers, and have been tweaking it to suit my needs. It's a good alternative to using the Excel templates.

Thank you!
Luminita


7.6.6 on AIX platform
Output: variety (Excel, HTML and PDF)
 
Posts: 33 | Location: New Hampshire | Registered: October 17, 2007Report This Post
Master
posted Hide Post
quote:
s, I sort of "inherited" this code from other developers, and have been


@Francis,
That's the type of code that Excel (and other MS Office docs) uses under the covers. I believe specifically if it is an "online" file.

To see this in action:
1. Open Excel.
2. Create a new Spreadsheet.
3. Populate with data (or don't).
4. Save as file type HTML.
5. Close Excel.
6. Open output in a text editor (suggest TextPad).
7. Bask in the glory of the Office-ified HTML/XML.


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Expert
posted Hide Post
ABT, thanks for that info. At least it appears my assumption is correct regarding the Excel styling. It seems that this type of code would be hard to maintain...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Excel and leading zeros

Copyright © 1996-2020 Information Builders