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

  • Home
  • SEARCH
  • 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 1013653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:08:11+00:00 2026-05-16T10:08:11+00:00

For transferring some data from to excel via php I am using this function

  • 0

For transferring some data from to excel via php I am using this function for the creation of labels;

function xls_label($row, $col, $value, $bold )  
{       
     echo pack("ssssss", 0x204, 8 + strlen($value), $row, $col, 0x0, strlen($value)); 
     echo $value;  
}

This adds a label in regular font.

Now I was wondering what do I need to add to this function to make the font of the label bold?


I do not want to use any library since I just need this one simple function.

  • 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-05-16T10:08:11+00:00Added an answer on May 16, 2026 at 10:08 am

    I’d say use a library, because (as Marc B has said) “If you’re using formatting/fonts, then it’s no longer a “very simple” Excel file.”

    You don’t even say what BIFF version you need, so I’ll assume BIFF5 because you’re using a label cell marker of 0x204

    The significant element is the 0x0 value in your pack statement:

    echo pack("ssssss", 0x204, 8 + strlen($value), $row, $col, 0x0, strlen($value));
    

    You’ll need to create a Font xf record in the “Workbook Global Substream”, then set the 0x0 value to the xf identifier for that font record, +16.

    You don’t show enough of your code to identify where you’d need to add the new font record, but font records have a type of 0x0031. You should already be writing the default font record (xf = 0), so you’ll need to modify this section of your code to create a second font record with an xf of 1, which would mean that your 0x0 would need to be 0x11.

    For bold, this Font record needs a value of 0x02BC at offset 6. For future reference, in case you want to add further font styling subsequently, italic requires a bitmask of 0x0002 at offset 2, while strikethrough requires a bitmask of 0x0008 at offset 2. Offset 4 points to the colour index, if you want to change font colour, while offset 8 identifies superscript/subscript, and offset 10 identifies underline type. Offsets 11, 12 and 14 identify the font family, character set and size of the font name, followed by the font name itself.

    You can find full details of all the options at http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx

    As you can perhaps begin to appreciate, this is not as simple and straightforward as you might like to believe. That’s why most of us use libraries when working with complex binary format rather than trying to write it all ourselves.

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

Sidebar

Related Questions

I have been using the Bluetooth chat example for transferring data over Bluetooth from
I'm working on transferring data from one database to another. For this I have
I would like some advice on the best approach for transferring DB data from
I am trying to parse some output data from and PBX and I have
I'm generating two matrices using the following function (note some code is omitted): srand(2007);
I have some data that looks like this: +---+--------+-------------+---------------+--------------+ | | A | B
I need some advice on transferring a large amount of data to a MySQL
What is the fastest way of transferring few thousand rows of data from one
I'm trying to read serial data from my Arduino using Java. I have followed
I am copying some data from sql server to firebird over the network. Because

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.