Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Writing to Ms Word File
  FAQ FAQ  Forum Search   Register Register  Login Login

Writing to Ms Word File

 Post Reply Post Reply
Author
Message
MoneyRan View Drop Down
Beginner
Beginner


Joined: 11 Aug 11
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote MoneyRan Quote  Post ReplyReply Direct Link To This Post Topic: Writing to Ms Word File
    Posted: 11 Aug 11 at 10:59PM
Hi,
 
 In my program I am opening a Word .doc document, using DrawText to write information on it and then save it sing SaveToFile function.
 
When I open the file in MSWord, all the text that I worte is visible, but on the top and bottom, there is some header adn footer information which loks like garbage. Is there any way to remove that or make it invisible?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 11 at 9:48AM
Hi!

A bit curious ;-)
DrawText (and the whole QuickPDF-lib) is made for pdf-creation and
not for word-documents.

Cheers and welcome here,
Ingo

Back to Top
MoneyRan View Drop Down
Beginner
Beginner


Joined: 11 Aug 11
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote MoneyRan Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 11 at 2:14PM
Actually, what I am writing in the file is completely HTML. I tried writing it on PDF, but it comes up as HTML code. I looked up the DrawHTMLText, but apparently it does not support all the tags, hence the Word Document. I have been looking in the function reference for a function that will allow me to modify these headers and footers, but nothing yet.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 11 at 3:16PM

Can you post a code sample so we can see what you are doing ?  As Ingo mentioned Quick PDF Library does not work with Word Documents.

Could it be that you are using MS Word to save your document to PDF and then using Quick PDF to load the PDF file and add extra text to it ?

Andrew.
Back to Top
MoneyRan View Drop Down
Beginner
Beginner


Joined: 11 Aug 11
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote MoneyRan Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 11 at 6:04PM
I want to write a whole User Control to a file. This is what I am doing:
 
Convert the Control to HMTL:
 
Dim SB As New StringBuilder()
        Dim SW As New StringWriter(SB)
        Dim htmlTW As New HtmlTextWriter(SW)
        States1.RenderControl(htmlTW)

        Dim DataGridHtml As String = SB.ToString()
        Dim path As String = ConfigurationManager.AppSettings("appPath").ToString()
        'Dim extension As String = ".html"
        Dim filename As String = "ApplicationConfirmation_" & txtName.Text

Try to print the HTML on a document:

 This is what I had been doing:

'Dim open As Integer = QP.LoadFromFile(path + filename + ".doc")
        'QP.SetOrigin(1)
        'QP.DrawText(10, 100, 400.0, DataGridHtml)   <--- tried DrawHTMLText for PDF file
        'Dim save As Integer = QP.SaveToFile(path + filename + ".doc")


 This is what I started doing and works perfectly:

Dim writer As StreamWriter
        writer = File.CreateText(path + filename + ".html")
        writer.WriteLine(DataGridHtml)
        writer.Close() 

QuickPDf wrote HTML perfectly to an MS Word document along with some garbage Headers and Footers.
But since the HTML had table tags and everything in it, it did not write properly to a PDF file.
I just need to create a file, regardless of the application type. I have been using QuickPDf in other parts of my application,
so I wanted to stick to PDF file. But I had to change it.  Still, if there is any way to modify those headers,  I will appreciate some idea of how to go about doing it.



Edited by MoneyRan - 12 Aug 11 at 6:15PM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 11 at 8:51PM
Again:
QuickPDF is for pdf not for html or doc.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store