I want to add a picture to my opened word file. But not from file. I have some picture on a DC in my program and want it directly to Word document. Does anybody know how?
At least may be some documents to read advises.
Thanks in advance!
I assume you are able to get an IDispatch pointer to the Word document you plan on inserting the picture on...
Once you have that, you can select the Range you want... Once you have a Range the basic code in VB (which you can translate into C++) is:
Range.InlineShapes.AddPicture("yourfile.png")
Yes, I know you said you didn't have a file or didn't want to use one, but I recommend you create a temporary file, insert it into Word, and then delete it when you're done.
Use the CxImage library on codeproject.com to save your image to disk--assuming you know how to get a HBITMAP or CBitmap of the image you want to save/put into Word.
Related
I would like to make a watermark plugin in GIMP. I need to have the text of the watermark as input from the user. I'll try with g_message but it is not working: I can't read an input from user in the plugin.
Can you help?
Best regards.
Jean.
I assume your plug in already runs and "just" needs to have the possibility to ask the user to provide a string. The easiest solution would be to add a string as input parameter - this way GIMP takes care about showing the dialog to the user before calling your script. This can be done via the gimp_install_procedure(...) call that I assume you are using, specifically the params parameter of this function: This is an array of GimpParamDef structs where you specify the type (PF_STRING), name ("text") and description ("text of watermark") of your input parameter.
My intention is to edit the Normal.dotm file from word.
All the links i read and the examples talk about open the file in word, which opens as a template, add the styles that i want and save to use it later to create new documents.
In these examples, when i open the file with word, i never see the characters inside the normal.dotm.
When i open the file with (for example) notepad or wordpad, it shows rare characters that i cant read.
It is possible to edit manually(or directly) or add the styles in the text inside the file? or the only way possible is to add the styles when i open the file with word as a template?.
I think once i found a link that said it was incorrect to directly add text to that file manually. But i am not sure of that.
Can you give me some advice?. Thank you.
This is the wrong forum for this type of question. SO is for questions about programming. In future please ask this sort of question on Super User.
To answer your question:
It is possible to edit Normal.dotm outside of Word but only if you are an expert in OOXML. If that is not the case open it inside Word using File | Open.
Documents in Word should be created from a template suited to the purpose, i.e. if you want to create letters first create a letter template with appropriate styles and content. You should not attempt to create all your documents based on the Normal template.
I have my own image encoder and decoder. What I want is to read DICOM images, extract uncompressed image pixels, compress them using my encoder and then write those compressed pixels back in the DICOM file in place of uncompressed pixels. Decoder would do the opposite. Is this possible to do in Imebra? I can read tags and pixels, but after I compress them, I'm not sure how to put them back (they are currently in char* buffer), or if this is even possible. I'm using Imebra in C++.
Alternatively, it would be okay if I could create completely new DICOM file, but in that case I would need to easily transfer all the DICOM tags from the old file.
If this is not possible in Imebra, is there some other C++ library that allows this?
Edit:
Thanks for the answer, Paolo. However, original DICOM image still remains unchanged (using second option). Can you say am I doing something obviously wrong here?
std::unique_ptr<imebra::DataSet> loadedDataSet(imebra::CodecFactory::load(imgNameM));
imebra::WritingDataHandlerNumeric* dataHandler = loadedDataSet->getWritingDataHandlerRaw(imebra::TagId(imebra::tagId_t::PixelData_7FE0_0010), 0);
dataHandler->assign(buffer, size);
delete dataHandler;
loadedDataSet is not empty, I checked with bufferExists.
Edit 2:
Yes, I didn't save it. Now I added that line and managed to modify PixelData element which was solves my original problem. Thanks. However, some other parts of the file are now automatically also changed. More than 100 empty bytes are added at the beginning of the file, although this doesn't bother me that much. What bothers me is that (0008,0005) Specific Character Set tag is now added and its value isn't set (it's empty) which then causes CharsetConversionNoTableError when trying to read tags of that modified file. If I remove that tag manually and fix the group length, I can read tags normally. Is there a possibility to avoid this behavior?
Imebra already provides the encoder/decoder for lossless jpeg, baseline and extended jpeg, RLE.
There are several ways of adding your own codec to Imebra:
derive a class from imebra::implementation::codecs::imageCodec
or encode an image into a char buffer, then add it as raw content using imebra::DataSet::getWritingDataHandlerRaw which allows you to write the tag raw content. getWritingDataHandlerRaw returns a WritingDataHandlerNumeric. Use WritingDataHandlerNumeric::assign to move the bytes buffer into the data handler, then delete the data handler to cause it to commit its content into the dataset.
The example changeTransferSyntax that comes with the library shows how to create a new dataset with all the same tags from the source dataset but with a different transfer syntax (including a different image compression)
According to MSDN:
When the system creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary.
Yeah, only it doesn't. I have an edit control in my app that shows various logs, and I keep adding text to it using EM_SETSEL message (to find the end of the text in control's buffer) and EM_REPLACESEL message (to append some text to it). I don't know if it's a best way, but it's been working well so far. Today, however, I found out that if I try to append some text when there are lots of logs in edit control already, my app fails to do so. Maximum lenght of text that's shown in it is equal to 30k characters and when I try to append any more logs, it just fails, nothing happens. At first I set it as read-ony edit control, but nothing changes if I make it editable. Just when I try to type more than 30k characters in it, it acts as if I wasn't typing anything.
And now: I know that you can handle buffer expanding by yourself, but that's not the case here. If it is written that it should be expanded automatically, why doesn't it occur? Maybe I accidentaly set something that stops the application from increasing the buffer's size? I don't know and I can't find any answer to that, so I was just wondering if there's any way to actually make my application to expand that buffer on its own.
You need to set a text limit with the EM_LIMITTEXT message. Otherwise:
Before EM_LIMITTEXT is called, the default limit for the amount of
text a user can enter in an edit control is 32,767 characters.
How to set color to the card object?
There is some information about which are the support html tags, however i don´t know how to use it.
Card m_InstructionCard new Card(this);
String texto = getString(R.string.instruction_card_text);
m_InstructionCard.setText(Html.fromHtml(texto));
m_InstructionCard.setTimestamp(R.string.instruction_card_info);
m_InstructionCard.addImage(R.drawable.second_capture);
The function setText don´t support spanned.
Should I use style? There is some example of how do it?
As i can´t use card with resource xml, i don´t know how to do it.
The Card.setText method currently only supports unstyled Strings. Please file an enhancement request on our issue tracker if you would like to see other features.