Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. windows application html page problem.

windows application html page problem.

Scheduled Pinned Locked Moved C#
csharphtmlsysadminhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drey1
    wrote on last edited by
    #1

    I have a windows application in c#. I am required to create an html file and save on a certain directory. At the moment I am writing the file using streamwriter. But I do have a problem with the images in the file in deployment. I notice that I have available when I add an item to the project to add html page. Does anyone know if that can be dynamically altered? or anyone have a better way to add an html page? thank you tephra

    E H 2 Replies Last reply
    0
    • D drey1

      I have a windows application in c#. I am required to create an html file and save on a certain directory. At the moment I am writing the file using streamwriter. But I do have a problem with the images in the file in deployment. I notice that I have available when I add an item to the project to add html page. Does anyone know if that can be dynamically altered? or anyone have a better way to add an html page? thank you tephra

      E Offline
      E Offline
      Esmo2000
      wrote on last edited by
      #2

      drey1 wrote: I notice that I have available when I add an item to the project to add html page. Sorry tephra, could you make that clearer?

      D 1 Reply Last reply
      0
      • E Esmo2000

        drey1 wrote: I notice that I have available when I add an item to the project to add html page. Sorry tephra, could you make that clearer?

        D Offline
        D Offline
        drey1
        wrote on last edited by
        #3

        Just to test, I created a simple html page and inserted a gif image. I was able to view it in a browser. However, at first view, I can not do anything else with it. It seams static. I do not know how I can dynamically add any thing to it. I am not sure that is the right way to go for me. ie. I am trying to create an index html file with links to PDF files, and those files will always change. So the html has to be dynamic. thank you

        1 Reply Last reply
        0
        • D drey1

          I have a windows application in c#. I am required to create an html file and save on a certain directory. At the moment I am writing the file using streamwriter. But I do have a problem with the images in the file in deployment. I notice that I have available when I add an item to the project to add html page. Does anyone know if that can be dynamically altered? or anyone have a better way to add an html page? thank you tephra

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          You need to use relative paths in your HTML file that you're writing. I suggest using the Microsoft way of doing it, which is what happens when you save a page from Internet Explorer using the default settings: the HTML page is saved to disk and a folder is created with the same name and "_files" appended. In that directory are all the files that can be resolved (images, script files, etc.). When the HTML file is saved the path to those linked files are changed to a relative path - relative to the document, like so: filename_files/img1.gif filename_files/img2.jpg Try it. Save a document with images to disk and examine both the file and the folder with the same name. Using the same convention is consistent with other applications that use MSHTML (including IE, Word, FrontPage, and more), as well as other third-party libraries that want to provide a consistent user interface. Windows XP and newer platforms also allow users to manage both the HTML file and related folder as a single unit. How you alter it is by parsing the text as you write it and changing what gets written, then skipping that portion of the text you're writing. You could also modify it before saving. It really just depends on your requirements and if you can modify the in-memory document. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups