?
Solved

saving inside of div tag to pdf or word via php?

Posted on 2009-05-13
2
Medium Priority
?
2,172 Views
Last Modified: 2013-12-13
i can create and save some word, excel, pdf files via php. but i am saving data to array then post to other page and create word file and parsing data after pasting to it and saving file. but i dont want to do that way because data vary i want to copy data inside specific div tag and paste to document and save it. because inside div tag there will be image, decorated text and etc. how can i do this.

<div id="print_to_word">
Some Data
</div>
<input type="button" onclick="run function">

or

<div id="print_to_word">
Some Data
</div>
<input type="button" onclick="run function">
0
Comment
Question by:phparmy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 2000 total points
ID: 24391208
You could have a hidden form

<form name="createword" style="display:none" action="create-word.php" target="_blank" method="post">
   <input type="hidden" name="html" />
</form>

<input type="button" onclick="createWord()" />

<script type="text/javascript">
function createWord() {
  document.forms['createword'].html.value = document.getElementById('print_to_word').innerHTML;
  document.forms['createword'].submit();
}
</script>

Then you have to have your word creation script use the $_POST['html'] as its document content.
0
 

Author Comment

by:phparmy
ID: 24409178
thank you very much this solve my problem.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question