Jump to content

Criação de ficheiro HTML


LvZito
 Share

Recommended Posts

Olá a todos,

Estou a tentar criar um ficheiro em HTML a partir do VB com este código, simplificado para ser mais fácil perceber o problema:

    Dim MyStream As New IO.FileStream(sAppPAth & "\report.html", IO.FileMode.Create)
    Dim MyWriter As New IO.StreamWriter(MyStream)
    Dim HTML_File As String
    HTML_File = ""
    HTML_File += "<html>"
    HTML_File += "<head>"
    HTML_File += "<title>Report</title>"
    HTML_File += "<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 > "
    HTML_File += "</head>"
    HTML_File += "<body>"
    HTML_File += "<p> Comentário: João JOÃO </p>"
    'close page
    HTML_File += "</body>"
    HTML_File += "</html>"
    MyWriter.Write(HTML_File)
    MyWriter.Close()
    MyStream.Close()

    Try
        Dim StartInfo As New ProcessStartInfo
        StartInfo.FileName = "iexplore.exe"
        StartInfo.Arguments = "file:" + sAppPAth + "\report.html"
        StartInfo.WindowStyle = ProcessWindowStyle.Maximized
        StartInfo.UseShellExecute = True
        System.Diagnostics.Process.Start(StartInfo)
    Catch ex As Exception
        MsgBox(ex.Source + " : " + ex.Message)
    End Try

:

O ficheiro é criado sem erros mas os caracteres com acentos aparecem com caracteres estranhos (em vez de áã e Ã).

Alguém tem alguma sugestão?

Obrigado pela ajuda,

LvZito

Nota: O meu windows está em inglês, tal como o Visual Studio, mas a «culture» está como «pt-PT»

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.