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 8757525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:19:20+00:00 2026-06-13T14:19:20+00:00

I cannot read styles from xls by PHPexcel. I browsing for a solution a

  • 0

I cannot read styles from xls by PHPexcel. I browsing for a solution a lot but everywhere writes solutions for write xls but I like it to read.
I like especially strikethrough but it cannot reads neither this nor any other style informations.
My code is the following, this reads all data correctly but nothing more. Im sure to make text styled in the xls.

require_once 'PHPExcel.php';
$filepath = "path/to/your/xls/file.xls";
$inputFileType = PHPExcel_IOFactory::identify($filepath);

$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($filepath);

$total_sheets = $objPHPExcel->getSheetCount();
$allSheetName = $objPHPExcel->getSheetNames(); 
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0) ;
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);

$headingsArray = $objWorksheet->rangeToArray('A1:' . $highestColumn . '1', null, true, true, true);
$headingsArray = $headingsArray[1];

print_r( $objWorksheet->toArray() );

Does anybody have an idea?

thx

  • 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-13T14:19:21+00:00Added an answer on June 13, 2026 at 2:19 pm

    PHPExcel is perfectly capable of reading styles from xls files: have you actually tried getting the style details from a cell, because your code here doesn’t show any tests to check that styles have been read?

    $objWorksheet->toArray()
    

    reads the content from cells as simple PHP scalar values.

    To determin the styling of a cell, you need to read that cell’s style details.

    e.g.

    $cellHasStrikeThrough = $objPHPExcel->getActiveSheet()->getStyle('B2')
        ->getFont()->getStrikethrough();
    

    The API documentation shows all the details for reading style information such as colours, fills, fonts, borders, etc

    EDIT

    A cell’s contain may also be rich text, with different parts of the content having different styles. If you retrieve a rich text value from a cell using

    $objPHPExcel->getActiveSheet()->getCellValue('B2');
    

    a richtext object will be returned. It is then possible to iterate through each block (or run) of the richtext object checking the style for that block

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

Sidebar

Related Questions

A client wants to ensure that I cannot read sensitive data from their site,
I read few articles on jsplumb , but cannot yet understand the usage. I
I've read the related questions but I cannot find one that suits my problem(or
I have read quite a few selcet+update questions in here but cannot understand how
I am trying to write a metro style application to read data from a
I'm getting an an error TypeError: Cannot read property 'style' of undefined I'd be
I've read that you cannot read the HTML of another frame if that frame
I'm getting the error: Uncaught TypeError: Cannot read property 'constructor' of undefined When declaring
On the query below I keep getting this error: Cannot read the next data
I'm receiving an error when I'm attempting to consume a web service: Cannot read

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.