Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8055027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:16:38+00:00 2026-06-05T08:16:38+00:00

I am creating a small script that imports data from xlsx file into the

  • 0

I am creating a small script that imports data from xlsx file into the db. I am using PHPExcel library to read the data. The problem is it doesn’t seem to have a way to convert characters into their equivalent html tags. The reason behind this is, I am going to pull the saved data into a page with html tags already. So one way I can think of to solve this is to parse the text taken from a each cell by the reader and convert each character to its html tag equivalent. Here’s a sample of text from the xlsx cell:

Contributing factors that increase the risk of frequent headaches:

  • Anxiety
  • Depression
  • Sleep disturbances
  • Obesity
  • Snoring
  • Excessive use of caffeine
  • Excessive use of pain medication
  • Frequent strain on the head and neck
  • Eye problem
  • Smoking
  • Alcohol intake
  • Use of prohibited drugs

I’d like to convert the circular bullet and line breaks into their equivalent html tags before saving to the db. How do I achieve this?

EDIT: Here’s the code:

<?php

include 'PHPExcel.php';

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
//$objReader->setReadDataOnly(true);

$objPHPExcel = $objReader->load("test.xlsx");
$objWorksheet = $objPHPExcel->getActiveSheet();

?>

<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
<?php
echo '<table>' . "\n";
foreach ($objWorksheet->getRowIterator() as $row) {
  echo '<tr>' . "\n";

  $cellIterator = $row->getCellIterator();
  $cellIterator->setIterateOnlyExistingCells(false); // This loops all cells,
                                                     // even if it is not set.
                                                     // By default, only cells
                                                     // that are set will be
                                                     // iterated.
  foreach ($cellIterator as $cell) {
    echo '<td>' . $cell->getValue() . '</td>' . "\n";
  }

  echo '</tr>' . "\n";
}
echo '</table>' . "\n";
?>
  </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:16:39+00:00Added an answer on June 5, 2026 at 8:16 am

    htmlentities should do the trick along with nl2br:

    $value = $cell->getValue();
    $value = htmlentities($value);
    $value = nl2br($value);
    

    If the string is in doublequotes you might want to get rid of the quotes before applying htmlentities:

    $value = $cell->getValue();
    $value = trim($value, '"');
    $value = htmlentities($value);
    $value = nl2br($value);
    

    htmlentities would render the bullet as &bull; so you’ll get a visual glyph representing the bullet, not a ul/ol list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently creating a small C# program that inserts data from files into a
I am creating a small tool that reads csv file data which has got
I'm creating a system that turns a small script into a dll. I'm encountering
I am creating a .bash_profile script, and I have run into a small problem.
While creating a small aplication in ExtGwt I've bumped into such problem: Is there
I'm creating a small script to automatically convert files from .jpg to .png: import
im new to javascript and am intersted in creating a small o3d script: <!DOCTYPE
I've created a small script to test creating my own help based powershell and
I am creating a small website that allows a user to browse some of
I'm creating a small solver that takes three arguments: number of hours, current time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.