2

I am using phpexcel to export my data into excel but some words are not exporting into excel but these words are showing in Array when I print_r my data

These are few lineswhich are not exporting but showing in array -

  1. Over 44 million Microsoft customers using leaked passwords

  2. New Zealand's White Island Volcano Suddenly Erupted While Tourists Were Visiting

  3. K'taka bypolls: BJP leads in 10, Congress, JD-S in 2 each

  4. Ten Cool and useful gadgets that make great last-minute gifts and all are under $50

  5. The farmer who left GOP: Trump 'has failed' at replacing NAFTA

  6. Huge investment in Odisha by Centre: President

  7. 44 million Microsoft customers using leaked passwords

Here is my PHP code -

if ($result['type'] == "WEB") {
    $sheet->setCellValue('M' . ($results + 2), $result['headline']);
   //exporting headline data
    $sheet->getCell('M' . ($results + 2))->getHyperlink()->setUrl($result['url']);
    $sheet->getCell('M' . ($results + 2))->getHyperlink()->setTooltip('Navigate to website');
}
Dharman
  • 30,962
  • 25
  • 85
  • 135
Utsav Upadhyay
  • 415
  • 6
  • 21
  • actually which words are not exporting to excel file? is that $result['headline'] or $result['url']. – Anitha Dec 09 '19 at 10:10
  • 1
    i already mentioned 7 words example that aren't exporting – Utsav Upadhyay Dec 09 '19 at 10:14
  • Can you determine if it is `$result['headline']` or `$result['url']` that is actually not being exported? I would suspect the latter and suggest that perhaps `urlencode` of `$result['url']` is needed. – Dave Dec 09 '19 at 12:38
  • oh that all those 7 points are not exported?. okay where is that line of codes, you haven't shared it. If those lines are in array, then you cannot write it on excel file. convert them into string and try it @UtsavUpadhyay – Anitha Dec 09 '19 at 16:21
  • 2
    Sorry for late reply $sheet->setCellValue('M' . ($results + 2), $result['headline']); //it import data from mysql in array $sheet->getCell('M' . ($results + 2))->getHyperlink()->setUrl($result['url']); //this line import url from database and concatenated with $result['headline'] so i guess you got my got and issue. @Anitha – Utsav Upadhyay Dec 12 '19 at 11:37

0 Answers0