How to know the number of lines of text in iFrame

Hi,

We are using iFrame in our web application to take the text data and provide the facility to format the data as per the user need. Typing, formatting the data and updating the to the data to database is working fine. When we are printing, we are getting the data from database and updating to text innerhtml. So the data is also printing fine. But when the data is too long and we need to start new page, I am expecting we need to know the number of ines in the content. So that as per the measure, I can print the data correctly in one page and move to the next page by leaving the required space for the header portion. This is the way we are taking the data in java script.

When we are taking the data
var testresult = window.frames["textEditor"].document.body.innerHTML;

After we retrive the data, we are upating to the control -
 document.getElementById('OPLABTESTRESULTREPORT:TEMPLATE1').innerHTML = strTextResult;

I am thinking that if I can know the number of lines at the times of the text data to the database and I can save the value and follow that value count for better formatting in page level.

If any other way to find the numbers of lines from iFrame, that would be greatly appreciated.

Thank you,
Murthy

Any response to my query,
Finsol123Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Serve a PDF - safest way to be able to format the way you want
0
Finsol123Author Commented:
I am sorry I did not understand the comment completely. As I mentioned, since I need to take input from the user, I need to have an editable field in the page. So we are giving iFrame there. So we are taking the data and updating to database, I would like to get the number of lines that time and update to database. Even after retrieve also, if I get, that is also fine. But I did not understand how pdf can be used here. If you can explain little more in detail, that will be helpful.

Thank you,
Murthy
0
Michel PlungjanIT ExpertCommented:
You are saying

But when the data is too long and we need to start new page, I am expecting we need to know the number of lines in the content. So that as per the measure, I can print the data correctly in one page and move to the next page by leaving the required space for the header portion

So I read that  you do not need to know the number of lines when you save but instead when you print.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Finsol123Author Commented:
Correct. Even if I get the number of lines before print, that would be helpful to me. Because sometimes we also combine the text with some other content, where I need to know howmuch the text content takes space and how much left on page. Then I can decide, whether I should start the text content on fresh page or I can print in the left over space (if it fits in the available space). For this purpose, I am looking for number of lines in the content.

Thank you,
Murthy
0
Michel PlungjanIT ExpertCommented:
Do you have <BR> or \n in the content?

You can split on '<br>' and count length
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ahoffmannCommented:
are you saying that printing is done with javascript from within the web page in the browser?
0
Finsol123Author Commented:
Thanks for your comments.

" Do you have <BR> or \n in the content? You can split on '<br>' and count length"

Yes, we have <BR>, <P> tages. But when we use them, we are not getting exact number. Some times it is being correct for 90% and some times it is 50% correct. So there is lot of fluctuation. So we are looking any better way to handle.

"are you saying that printing is done with javascript from within the web page in the browser?"

Yes, we are getting the content and assigning to outputtext as innerhtml and printing along with the other controls like grids and other output texts. So if I have the correct number of lines with me, then I can correctly format the contet in the print.

Any other suggestions, really appreciable.

Thank you,
Murthy
0
ahoffmannCommented:
>> Yes, we have <BR>, <P> tages.
if you have P (or any other block tags), the rendering engine decides where to use line breaks unless you forced the egine to behave different (i.e. with CSS' white-space:pre)
hence I guess that you aproach to count the lines is useless

i.g. you should format the content with CSS, then the browser's print functionality will do a good job but not a prefect one for everybody ;-)

quote http://www.thenoodleincident.com/tutorials/design_rant/
  The Web is not Print
        This isn't news to anyone. But the web isn't screen either.
         Or more accurately it is print, and screen, and voice, and
         many other things.
0
Finsol123Author Commented:
We implemented as suggested, but the objective is not completely achieved. We looked other options as other experts mentioned. But those things can not be taken for requirement. For now, we are taking this as our solution

Thank you,
Murthy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.