0

I have created CSV file using following code.

<?php
    $orders = '<table><tr class="dataTableRow"><td><b>Order ID</b></td><td>Ordered By</td><td>Email</td><td>Ordered On</td><td>Completed On</td><td>Line Items</td><td>Order Total</td>></table>';
    $text = "PHP";
    $list = array (
    array('111', '222', '333'),
    array($text),
    array($orders)
    );

    $fp = fopen('file.csv', 'w');
    foreach ($list as $fields) {
    fputcsv($fp, $fields);
    }
    fclose($fp);
?>

All data in CSV is properly displayed except the HTML content. I want to format contents inside CSV. I need some text in bold and some in italic.

Output of code

Is there any other way or any solution for this? Please help if somebody knows.

2
  • CSV is TEXT only. Commented Apr 10, 2017 at 5:11
  • As my content is in German language, All the calculation which results float values are getting messy in MS excel in German. So I have tried CSV which is showing correctly all the calculation done in the file on both the MS Excel(German and English). That is why I jumped from XLS to CSV. Now got stuck to format the content inside the file. Commented Apr 10, 2017 at 5:45

1 Answer 1

1

No chance, pal. CSV is plain text and you cannot format anything in plain text :-)

Sign up to request clarification or add additional context in comments.

1 Comment

Ups. I didnt know this. Thanks for your guidance. I will find another way for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.