如何将相当于blob大小的值赋给Delphi中的字符串?我正在积极寻求任何帮助。
我的要求是:
'String literal size too big'.错误。发布于 2015-12-22 17:26:46
如果你做了你应该在这里做的事情,并展示了你的代码,特别是你的第4项,这会有所帮助;读者不能看到你的屏幕,也不应该猜出你到底在做什么来引发错误。如果你在阅读完这个答案后仍然被困住了,我建议你编辑你的Q来包含你的相关代码。
在我看来,下面的代码似乎满足了您的“需求”中的第3和第4项,因为它展示了一种将结构化文档B插入到包含字段的文档A中的方法,而无需获得您引用的错误消息。小心,它不是非常彻底的测试,但它至少可能会让你走上正确的路线。
procedure TForm1.CreateWordDoc;
var
DocText : String;
MSWord,
Document,
Document2,
SourceRange,
Table : OleVariant;
begin
MSWord := CreateOleObject('Word.Application');
MSWord.Visible := True;
// Create a document containing a field
Document := MSWord.Documents.Add;
DocText := 'Hello Word!';
MSWord.Selection.TypeText(DocText);
MSWord.Selection.Fields.Add(Range:= MSWord.Selection.Range, Type:=wdFieldEmpty,
PreserveFormatting:=False);
MSWord.Selection.TypeText(Text:='afield');
MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=2);
// Create a second document containing some structured text
Document2 := MSWord.Documents.Add;
DocText := 'Second document';
MSWord.Selection.TypeText(DocText);
Table := MSWord.ActiveDocument.Tables.Add(MSWord.Selection.Range, 2, 2);
Table.Cell(1, 1).Range.Text := '1,1';
Table.Cell(2, 1).Range.Text := '2,1';
Table.Cell(1, 2).Range.Text := '1,2';
Table.Cell(2, 2).Range.Text := '2,2';
MSWord.Selection.EndKey( Unit:=wdStory);
MSWord.Selection.TypeParagraph;
Document2.Select;
SourceRange := MSWord.Selection.Range;
// Now, copy document2 into the field in the first document
// For simplicity, this uses the index of the field to identify it
Document.Fields.Item(1).Result := SourceRange;
end;最后,请注意,在“Delphi语言”中,"blob“一词通常指存储在数据库字段中的”二进制大对象“。但这似乎并不是你要问的问题,我也不知道你的Q的标题和你的问题有什么关系。
https://stackoverflow.com/questions/34418625
复制相似问题