Click here to Skip to main content
15,947,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi please help.
I have defined in MYSQL a table with a blob field named RTFText.
The display is performed with richtextboxextended.dll.
Definitions:

private RichTextBoxExtended.RichTextBoxExtended richTextBoxExtended1;
this.richTextBoxExtended1 = new RichTextBoxExtended.RichTextBoxExtended();

//
// richTextBoxExtended1
//
this.richTextBoxExtended1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
this.richTextBoxExtended1.DetectURLs = true;
this.richTextBoxExtended1.DocumentName = "document.rtf";
this.richTextBoxExtended1.Location = new System.Drawing.Point(240, 8);
this.richTextBoxExtended1.Name = "richTextBoxExtended1";
this.richTextBoxExtended1.PrintActions = RichTextBoxExtended.PrintActions.StandardPrint;
this.richTextBoxExtended1.ShowBold = true;
this.richTextBoxExtended1.ShowCenterJustify = true;
this.richTextBoxExtended1.ShowColors = true;
this.richTextBoxExtended1.ShowFont = true;
this.richTextBoxExtended1.ShowItalic = true;
this.richTextBoxExtended1.ShowLeftJustify = true;
this.richTextBoxExtended1.ShowOpen = false;
this.richTextBoxExtended1.ShowPrint = true;
this.richTextBoxExtended1.ShowRedo = true;
this.richTextBoxExtended1.ShowRightJustify = true;
this.richTextBoxExtended1.ShowSave = false;
this.richTextBoxExtended1.ShowStamp = false;
this.richTextBoxExtended1.ShowStrikeout = false;
this.richTextBoxExtended1.ShowUnderline = true;
this.richTextBoxExtended1.ShowUndo = true;
this.richTextBoxExtended1.Size = new System.Drawing.Size(720, 480);
this.richTextBoxExtended1.StampAction = RichTextBoxExtended.StampActions.EditedBy;
this.richTextBoxExtended1.StampColor = System.Drawing.Color.Blue;
this.richTextBoxExtended1.TabIndex = 21

private System.Windows.Forms.RichTextBox ergebnis;

            ergebnis = richTextBoxExtended1.RichTextBox;
            ergebnis.WordWrap = true;
            ergebnis.AcceptsTab = true;
            ergebnis.ShowSelectionMargin = true;
            ergebnis.KeyUp += new KeyEventHandler(ergebnis_KeyUp);
            richTextBoxExtended1.Toolbar.Buttons[richTextBoxExtended1.Toolbar.Buttons.Add("")].Style = ToolBarButtonStyle.Separator;
            tbGetPic = richTextBoxExtended1.Toolbar.Buttons[richTextBoxExtended1.Toolbar.Buttons.Add("")];
            tbGetPic.ToolTipText = "Vorhandene Bilder können ausgewählt werden";
            try
            {
                tbGetPic.ImageIndex = richTextBoxExtended1.Toolbar.ImageList.Images.AddStrip(imageList.Images[3]);
            }
            catch { }
            tbGetDrw = richTextBoxExtended1.Toolbar.Buttons[richTextBoxExtended1.Toolbar.Buttons.Add("")];
            tbGetDrw.ToolTipText = "Vorhandene Zeichnungen können ausgewählt werden";
            try
            {
                tbGetDrw.ImageIndex = richTextBoxExtended1.Toolbar.ImageList.Images.AddStrip(imageList.Images[4]);
            }
            catch { }
            tbPrint = richTextBoxExtended1.Toolbar.Buttons[20];
            richTextBoxExtended1.Toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolBar_ButtonClick);

It is possible to write ergebnis.Rtf to the blob field RTFText, but I found no way to get Data from RTFText into ergebnis.Rtf

ergebnis.Rtf = row["RTFText"].ToString() causes a crash. try...catch has not brought any hint (only "invalid file format" - but there is no file used!
Any solutions?

Thanks in advance mikr41
Posted
Updated 13-Jan-14 3:09am
v2

1 solution

I suspect you'll need something like this in there somewhere. You have a blob of bytes, you need to convert it back and using a fileStream and a binary writer can help you do that.

C#
// Create a file to hold the output.
 fs = new FileStream("logo" + pub_id + ".bmp", FileMode.OpenOrCreate, FileAccess.Write);
 bw = new BinaryWriter(fs);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900