Export to Excel not displaying numbers correctly - excel

I'm having a hard time getting account numbers to display correctly when exporting data from database to an Excel spreadsheet. The account number for one company, shows up correctly. However, others don't. Users have to double click in the cell to see the whole account number. I have Googled this issue and none of the solutions that I've tried worked.
<cfsetting enablecfoutputonly="Yes">
<cfsavecontent variable="sTest">
<cfoutput>
<table>
<tr><th align="center">ATTUID</th>
<th>Company Name</th>
<th align="center">Account Number </th>
<th align="center">Total Past Due Balance</th>
<th align="center">Date Sent</th>
</tr>
<cfloop query="returnQuery">
<tr><td>#attuid#</td>
<td>#companyname#</‌​td>
<td>#AccountNum4#‌​</td>
<td>#totalpastd‌​ue#</td>
<td>#datefor‌​mat(posted)# #timeformat(posted, "h:mm tt")#</td>
</tr>
</cfloop>
</table>
</cfoutput>
</cfsavecontent>
<cfcontent type="application/vnd.msexcel">
<cfheader name="Content-Disposition" value="inline; filename=export.xls">
<cfoutput>#sTest#</cfoutput>

If you are exporting html, you could also use the xml mso schema properties to format the number as text, without changing the actual cell value ie adding an apostrophe.
<cfheader name="Content-Disposition" value="inline; filename=someFile.xls">
<cfcontent type="application/vnd.ms-excel">
<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">
<body>
<table>
<tr>
<td style='mso-number-format:"\#";'>510074123456989</td>
</tr>
</table>
</body>
</html>

You can insert an apostrophe ' preceding the account number. This will force excel to treat numeric (any) data as text.

This usually happens when the column is not wide enough to display the data. Try and make the column wider and see if that corrects the issue.

Related

Pupeteer to generate pdf is rendering tables with gaps

I'm using Node Puppeteer to generate a PDF from a webpage using Chrome Headless. It works really well, apart from a small issue I'm coming across where if a table spans over more than one page sometimes one of the rows will appear larger than expected and the date column having text appear at the top of the row.
This is how it looks in the browser
This is how it is rendered on the pdf (some parts are blurred for confidentiality)
As you can see on the created column on the second page in the PDF view the date and time in the first row are distorted. There is nothing unusual about that row in the html version.
The table follows this structure;
<table>
<thead>
<tr>
<th>Project</th>
<th>Status</th>
<th>Creator</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div>Project Name</div>
<div>Reference</div>
</td>
<td>
<img src="status.png" alt="Some Stagus"> Some Status
</td>
<td>
<div class="avatar"></div>
</td>
<td>
<div>29/10/2020</div>
<div>10:00:00</div>
</td>
</tr>
</tbody>
</table>
I'm not sure if this is a bug with chrome headless, when I print preview in chrome is shows the same issue as the generated pdf. Any suggestions or pointers would be very welcome.
This is going to sound stupid, and I hate this answer... but it worked for me.
Add a dummy row in between your normal rows. Something like ...
<tr style="height: 0px; !important"></tr>
You'll notice that the broken row has 2x height. I'm guessing the issue is triggered when the first pixel of a row lands EXACTLY on a page break, and then the renderer attempts to add the row twice, once on the previous page and once on the current page. But since it doesn't fit on the previous page, it rolls over and doubles up on the current page. ( PURELY SPECULATION )
Given this hypothesis, adding a dummy row with no height between every normal row lets you hide this issue by having the dummy row be the target of the bug. I'm assuming that since its height it 0, it can always squeeze in on the previous page without overflowing and/or it does overflow and get doubled, but since its height is 0 it doesn't matter.
Anyways, this was a nightmare to figure out a hack-fix. It worked for me, I truly hope it works for you, and I hope puppeteer releases an update one day that improves on page-break logic.

How do I display list of multi-column clickable items?

I'm working on a project where I'm trying to display a list of messages. I want to have multiple fields in each row (Sent by, Message, date), and to be clickable (which then shows the thread the message is part of).
This is what I have so far. https://imgur.com/a/uU1sm64
I'm having problems aligning the data in the rows. For now, I have them as three ListItemText components under one ListItem for each row. I tried using tables but I can't get the OnClick function working on it.
What's the best way to get an aligned clickable multi-column list? Similar to gmail's web interface.
Thank you.
Is this the solution you are looking for? I used bootstrap hover table. On clicking the table row, I get the contents of the first cell. May be you should try getting the message ID or something related from the selected table row.
$("#display-table tr").click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
var value=$(this).find('td:first').html();
alert(value);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/js/bootstrap.min.js"></script>
<table id="display-table" class="table table-hover">
<thead>
<th>Sent By</th>
<th>Message</th>
</thead>
<tbody>
<tr>
<td>ABC User</td>
<td>how-do-i-display-list-of-multi-column-clickable-items</td>
</tr>
<tr>
<td>ADC User</td>
<td>how-do-i-display-list-of-multi-column-clickable-items</td>
</tr>
<tr>
<td>ADE User</td>
<td>how-do-i-display-list-of-multi-column-clickable-items</td>
</tr>
</tbody>
</table>

NetSuite: access sales order field from packing slip advance template

This is my first time to post a question and I need some help. I working with Packing slip advance template. Now I want access some fields and items sublist in sales order form but I can't. Can some one help me?
This is my code to access list items and access to get fields from sales order form.
My code from advance PDF/HTML templates
<#list salesorder.item as item>
<tr>
<td>${item?counter}</td>
<td>${item.itemid}</td>
<td>${item.description}</td>
<td>${item.quantity}</td>
<td>${item.units}</td>
<td>${item.rate}</td>
<td>${item.amount}</td>
</tr>
</#list>
<tr>
<td></td>
<td></td>
<td>Tax Code Summary <br/></td>
<td>Tax rate <br/> </td>
<td>Total Net <br/> ${salesorder.subtotal} </td>
<td>Total Tax <br/> ${salesorder.taxtotal}</td>
<td><b>${salesorder.total}</b></td>
</tr>
I tested your items list and it appeared to be working as expected for me. The default list is very similar to yours and works the same:
<#list salesorder.item as tranline>
<tr>
<td colspan="12"><span class="itemname">${tranline.item}</span><br />${tranline.description}</td>
<td colspan="3">${tranline.options}</td>
<td align="right" colspan="4">${tranline.quantityordered}</td>
<td align="right" colspan="4">${tranline.quantityremaining}</td>
<td align="right" colspan="4">${tranline.quantity}</td>
</tr>
</#list>
One thing to note is that ${item.itemid} won't work. You can do a double join, however, to get the id like this: ${item.item.internalid}.
As for the extra sales order fields, unfortunately, not all those fields can be accessed. Specifically, the ones in the total box are not accessible from the packing slip advanced pdf. You could, however, try to capture those total fields in a custom body field on the sales order using a workflow, and then display the custom field in your advanced pdf printout.

Python Webdriver - How can I select a radio button based upon the text of a separate label?

Using Python WebDriver, how can I select a radio button based upon the text of a separate element such as this label?
My current code has the ability to click the radio button by id. But I have no idea how it is possible to click it when I am depending on text from a completely separate element.
The following is a pic of what i'm up against.
All help is greatly appreciated! =)
I've created a simplified example of your html on the screenshot, and assuming you want to get radio button which following sibling has "test text2", you need to use xpath axes:
<table>
<tbody>
<tr>
<td><input id="test_id" type="radio" value="123" /></td>
<td>test text</td>
<td>test text2</td>
<td>test text3</td>
</tr>
</tbody>
</table>
XPath would be: //tr/td[contains(text(),"test text2")]/preceding-sibling::td/input
The logic is:
get an element with specific text
go to previous sibling element (sibling == same level element)
now go deeper to td/input from there

EE2 Embedded Template with Playa fields

Hopefully this is has a simple solution. I am pretty sure I am close. So here goes...
Code first.
{exp:channel:entries channel="client" url_title="{embed:client_name}"}
<tr>
{exp:playa:parents channel="project"}
<td>
{proj_name}
</td>
<td>
{proj_job_number}
{job_number}
{/proj_job_number}
</td>
<td>
{entry_date format="%m/%d/%Y"}
</td>
<td>
{proj_producer}
{producer_name}
{/proj_producer}
</td>
<td>
{proj_vendor}
{vendor_name}
{/proj_vendor}
</td>
<td>
<i class="icon-download"></i>
</td>
{/exp:playa:parents}
</tr>
{/exp:channel:entries}
This is the code from the embedded template I am using. I am trying to return each Project channel entry along with the other playa field values from the project channel entry. I am able to return the results correctly however I am trying to format returned values into a html table. So finally my question is... What do I need to do as far as markup/tagging/conditionals so I can have one Project channel entry display per html table row. Right now all entries to the playa field display in one table cell ending up with one row with all the table cells in it. I can post more code if needed and or clarify anything I am missing. Any help on this issue is much appreciated.
Cheers!
You need to place the <tr> tags inside the {exp:playa:parents} tag pair.

Resources