|
-
Aug 22nd, 2008, 10:48 PM
#1
Thread Starter
Fanatic Member
[2008] WYSIWYG - MSHTML Editor Project
Hey all,
Out of necessity, I need to build a ContentAdmin for clients so they can edit restricted html pages using a WYSIWYG editor.
The only source code I found was for .NET framework 1.0 (VS Studio 2003). Finding one for VB 2005-2008 was non-existant.
So, I have already hooked up MSHTML.DLL to VB.NET 2008 and have some of the functions working. And so far, it really is easy.
The hardest part is going to be inserting tables etc...
I would like to ask for anyones help and then share the basic version with everyone later if it is truly workable.
I will post changes and updates as to how I am doing.
WHAT IS MSHTML?
MSHTML is a dll used by Internet Explorer that allows editing of the html document. You can use the DLL as a WYSWYG editor. It goes beyond the RichTextEditor.
Last edited by epixelman; Aug 22nd, 2008 at 10:52 PM.
-
Aug 22nd, 2008, 10:49 PM
#2
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Update...
I have the following functions working:
- DesignMode On/Off
- Save html
- Bold text
- Color text
- Font size
Last edited by epixelman; Aug 22nd, 2008 at 10:52 PM.
-
Aug 23rd, 2008, 12:20 AM
#3
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Update... I have added...
- Italic
- Underline
- Font Name
- Horz Line
- Align Left - Center - Right
- Link
- Insert image
All works 1 to 3 lines of code each.
Now the hard part... the Table
Any ideas?
-
Aug 23rd, 2008, 09:20 AM
#4
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Hmmm...
After researching about inserting tables. In the past you could use the DHTML.OCX and TREDIT.DLL controls. And this would allow inserting of tables fairly easily.
However.... those controls are not being provided in Vista, and the OS (for security reasons) will balk at them.
Read this... http://msdn.microsoft.com/en-us/library/aa663363.aspx
So... I haven't found out how to insert tables using MSHTML.DLL yet.
-
Aug 23rd, 2008, 11:43 AM
#5
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Well...
I found a C# version of a control that has "inserting of tables"
However, I want to do this in VB
I am getting an erro trying to call MSHTML directly...
Code:
Try
Dim myTableObj As Object
mshtml.IHTMLTable(myTableObj) = (mshtml.IHTMLTable,WebB.Document.createElement("table"));
Catch ex As Exception
End Try
2nd line is error.
"mshtml.ihtml is a type and can not be used as an expression.
I am missing something.
-
Aug 23rd, 2008, 04:35 PM
#6
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
I am kind of stuck.
I have the correct reference.
I can see the events in the ObjBrowser
But I can not seem to find out how to get it to do what I want.
Any experience MSHTML users out there?
Last edited by epixelman; Aug 23rd, 2008 at 08:34 PM.
-
Aug 24th, 2008, 08:17 AM
#7
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Well... I found a bad work around to insert tables.
I created a form with a Browser on it.
I load an html file of a table (this would be a template)
I then use SendKeys to copy the table in EditMode then paste into the main browser window.
This is not how I want to do it, but it works.
Also, there is no setting rows-cols etc. They are already made htm file.
So, to use as a template system, I would need quite of few different layouts.
And... If I want a table with no border being visible. It is like that in the main browser. So I would have to figure out a way to turn the border on when in design mode, then off when EditMode is off.
I knew this would be hard.
-
Aug 24th, 2008, 11:53 AM
#8
Thread Starter
Fanatic Member
-
Aug 24th, 2008, 03:25 PM
#9
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
I kind of got around the save box. I don't think it is completely fool proof depending on how you use it.
Code:
'we have to have this to avoid the "save changes" dialog in a browser.
WebB.Document.Write(String.Empty)
'save html file
Dim sw As StreamWriter = New StreamWriter(HtmlFile)
'save text box
sw.Write(txtHtml.Text)
'close file
sw.Close()
'refresh browser page
WebB.Navigate(HtmlFile)
I am sure there has to be a better way to disable that in the browser. Maybe it is a setting on IE
-
Aug 24th, 2008, 07:29 PM
#10
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Kliemna
I downloaded your sample and got some tips.
But, I have a couple questions.
1) How do I get and replace tags (with accompaning html code)
2) Is there a way I can double-click on tables and load the tag/code and make changes and send back to the document.
Last edited by epixelman; Aug 24th, 2008 at 07:36 PM.
-
Aug 24th, 2008, 07:39 PM
#11
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Also, I have spent roughly 4 hours scouring MSDN on inserting tables. And I still can not seem to get it to insert directly without having to use my work around.
I need an experience pro!!
-
Aug 25th, 2008, 06:36 AM
#12
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Kliemna, you our there?
-
Aug 25th, 2008, 02:06 PM
#13
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Kliemna,
I seen you were here today.
Can you reply?
-
Aug 26th, 2008, 07:47 AM
#14
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
I know this is a tough one... isn't it?
-
Aug 26th, 2008, 12:54 PM
#15
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Where are you Kliemna?
-
Aug 27th, 2008, 01:24 PM
#16
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Well... it looks like no one has any input.
Does anyone want to put the sample app (picture above) in the code bank as it is?
The inserting of tables works, but not the right way that it should be done.
-
Aug 29th, 2008, 05:47 AM
#17
Thread Starter
Fanatic Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Hmmm.... Looks like this is a dead thread. No one is replying. I guess no one is interested.
-
Sep 1st, 2008, 05:44 PM
#18
New Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Hi, I'm fairly new to .net (I'm a small time vb6 coder who finally made the switch )
I've just started to code something similar but haven't got much so far. I was wondering if you might be posting your source for us to take a look at?
I'm trying to code a wysiwyg editor for a web based platform rather than a web design app.
I was also wondering if this stuff can be used to code/view xhtml an stuff as it seems it can only do html.
It seems like you've been talking to yourself quite a bit in this thread sorry i can't help.
-
Nov 6th, 2008, 07:38 PM
#19
Re: [2008] WYSIWYG - MSHTML Editor Project
did you ever solve this? I don't think I ever looked at this thread before, and I randomly came across it today...
-
Nov 6th, 2008, 08:42 PM
#20
New Member
Re: [2008] WYSIWYG - MSHTML Editor Project
Hey kleinma,
I'm still here
I've not worked on my editor project for a while as I've been busy with work.
while googling I didn't find out much and sort of got the impression I was barking up the wrong tree with mshtml.
I'm trying to build an app similar to a lite version of expression web or dreamweaver where you can edit code or design. I also need it to be able to handle different code like dhtml and xhtml and stuff.
You have any ideas on how to start a project like this? Is there an api or something?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|