-2

Is it possible to read a text file with PHP with styles?

My client doesn't want to write any code (even [b][/b]) and he has to send those text files to some translators to translate them into 4 languages.

Then i have to post them on a site. They are very large texts and i was wondering how can i deal with this to keep the format without having to read and format all of them with BBcode or HTML code directly (as they are updated very often with some changes)

hakre
  • 193,403
  • 52
  • 435
  • 836
Alvaro
  • 40,778
  • 30
  • 164
  • 336
  • What kind of document are these files? .doc .docx? – Dale Apr 18 '12 at 15:02
  • If the files are word documents, this may help you. Good luck! http://stackoverflow.com/questions/188452/reading-writing-a-ms-word-file-in-php – Dale Apr 18 '12 at 15:04
  • HE is currently doing it on word and i am reading it saving as HTML and dealing with some ugly code. But it shows some visual erros from time to time and i am not happy with its results. – Alvaro Apr 18 '12 at 15:22

1 Answers1

0

I see 2 possible answers :

  • Strip all tags, send texts to translator and re-add style formatting tags (see strip_tags())

  • Write a script that converts texts into an editable file format like .docx or .odt and reverse the process when texts comes back. (there are some PHP libraries that can do that)

noli
  • 3,535
  • 3
  • 18
  • 20
  • Currently i was reading text from a .doc file converted into .html, but MS Word add too many stuff and dealing with it produce some visual errors from time to time... About strip_tags, i know it but what you mean with re-adding it? Manually? – Alvaro Apr 18 '12 at 15:15