Nigerian currency is not showing in fpdf - currency

I want to show the Nigerian currency in my pdf using fpdf. But it not showing.Thanks in advance for any help.$custom_currency = '₦';
$pdf->Cell(60,20," $custom_currency.'-'.$g_total",1 , 1, 'L', 1);

Related

PHPSpreadsheet: getHighestDataRow/getHighestDataColumn after fromArray

I'm using fromArray to load an array of data into a worksheet. This is working fine. After doing so, getHighestDataColumn and getHighestDataRow do not seem to be updated. Is there a way to force PHPSpreadsheet to recalculate these values after calling fromArray?
[edit] An update seems to have fixed the issue.
Be aware to not use the github#PHPExcel lib if you're still using them.
They've said to update to its directly successor, which is beig maintained and recently updated at github#PhpSpreadsheet
Recently Microsoft released an update which breaks some of the functionalities when we use the old lib.
Getting this example from their doc, you could try using the fromArray():
To set data from an array:
$arrayData = [
[NULL, 2010, 2011, 2012],
['Q1', 12, 15, 21],
['Q2', 56, 73, 86],
['Q3', 52, 61, 69],
['Q4', 30, 32, 0],
];
$sheet->getActiveSheet()
->fromArray(
$arrayData, // The data to set
NULL, // Array values with this value will not be set
'C3' // Top left coordinate of the worksheet range where
// we want to set these values (default is A1)
);
Then you follow this to extract data from the spreadsheet:
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
// Loop for each row
for ($row = 0; $row <= $highestRow; $row++) {
// here you extract the columns for that row
$columns = array_shift(array_values($sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE)));
}

Custom Page Number in TCPDF

i'm using TCPDF to generate my pdf. I have no idea for reset starting page number. I mean, i will generate report that starting page numer 3 (not 1) in footer, but the second page increment by 2 (3,5,6,7 etc)
Here is my code :
$_SESSION["hal"] = $_POST["hal"];
$_SESSION["f"] = $_POST["f"];
class MYPDF extends TCPDF {
// Page footer
public function Footer() {
// Position at 25 mm from bottom
$this->SetY(-25);
// Set font
$this->SetFont('helvetica', 'b', 8);
// Page number
$this->Cell(0, 15,$_SESSION["f"]." ". $_SESSION["hal"], 'T', false, 'R', 0, '', 0, false, 'T', 'M');
$_SESSION["hal"]++;
}
}
Can someone help please..
Done..
$_SESSION["hal"] = $_POST["hal"];
$_SESSION["f"] = $_POST["f"];
class MYPDF extends TCPDF {
// Page footer
public function Footer() {
// Position at 25 mm from bottom
$this->SetY(-25);
// Set font
$this->SetFont('helvetica', 'b', 8);
// Page number
//i add var to store current page
$halaman = $this->PageNo();
$this->Cell(0, 15,$_SESSION["f"]." ". ($halaman+$_SESSION["hal"]), 'T', false, 'R', 0, '', 0, false, 'T', 'M');
}
}
a other way is to use Page Groups. Better with no need of SESSION.
To start the Group:
$this->startPageGroup();
and to print:
$w_page = isset($this->l['w_page']) ? $this->l['w_page'].' ' : '';
if (empty($this->pagegroups)) {
$pagenumtxt = $w_page.$this->getAliasNumPage().' / '.$this->getAliasNbPages();
} else {
$pagenumtxt = $w_page.$this->getPageNumGroupAlias().' / '.$this->getPageGroupAlias();
$this->Cell(0, 0, $pagenumtxt, 'T', 0, 'L');

Google Chart Tooltip with Percentage

My chart is very simple and is something like this:
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['week', 'rate'],
['1', 0.156],
['2', 0.232],
['3', 0.446],
['4', 0.832],
['5', 0.702],
['6', 0.773],
['7', 0.842],
['8', 0.413],
['9', 0.278],
['10', 0.323],
['11', 0.312],
['12', 0.309],
['13', 0.134],
['14', 0.137]
]);
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 1}}
);
}
​
But I have NO IDEA how to format the data column to show as a pecentage in the tooltip. Can you guys give a hand?
Use a NumberFormatter:
var formatter = new google.visualization.NumberFormat({pattern: '#%'});
formatter.format(data, 1); // format column 1
You may also want to format the y-axis:
vAxis: {
maxValue: 1,
format: '#%'
}
Add a column like this
{role: 'tooltip'}
I had the same problem and fixed it.
See for yourself!

IOS - unwanted hyperlink in UIWebView

got this html that i insert as string to uiwebview
<div style="font-family: sans-serif;">
<p><p><u>George Barret</u> </p>
<p>Irish,
1728/1732-1784 </p>
<p><b><i>An Extensive Wooded River Landscape
with Fishermen Hauling in their Nets in the Foreground</i></b><b>, </b></p>
<p><b>1760s</b></p>
<p>Oil on canvas<br><span style="font-size: 13.513513565063477px; line-height: 19.988739013671875px;">137 x 195.5 cm</span></p>
<p>Heritage Gift, IIB Bank, 2005</p>
<p><span>NGI.4750</span></p></p></div>
i got a blue hyperlink on "1728/1732-1784"
anyone know why and how can i disable this behavior ?
Thanks
myWebView.dataDetectorTypes = UIDataDetectorTypeNone;
This will prevent your UIWebView from converting anything (phone numbers, links, email addresses) into clickable links. The attribute detectorTypes is a bitmask, and you can specify any or all of the following values OR'd together:
enum {
UIDataDetectorTypePhoneNumber = 1 << 0,
UIDataDetectorTypeLink = 1 << 1,
UIDataDetectorTypeAddress = 1 << 2,
UIDataDetectorTypeCalendarEvent = 1 << 3,
UIDataDetectorTypeNone = 0,
UIDataDetectorTypeAll = NSUIntegerMax
};
For example, to turn only email addresses and phone numbers into clickable links you would use:
myWebView.dataDetectorTypes =
UIDataDetectorTypePhoneNumber | UIDataDetectorTypeAddress;

How can i generate a fixed random numbers in c#?

I need to randomize fixed numbers, for example, 1,3,5,7,10. My output will be only 1,3,5,7 or 10. Please Help me! Thanks! Is there a way to randomize fixed numbers or user inputted numbers?
Get a random number from 0-4, then select from a dictionary of { 1, 3, 5, 7, 10 }.
int[] select = new int[] { 1, 3, 5, 7, 10 };
var rand = new Random();
int num = select[rand.Next(5)];

Resources