Im making a docx reader (libopc and C++) and I have problem when I want to get the minor and major Font from the theme1.xml. The problem is that I dont know how I have to write the namespace for attributes without it:
<a:latin typeface="Calibri"/>
I have tryed with:
mce_start_attribute(&reader, _X(""), _X("typeface")) {//type
_majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);
and:
mce_start_attribute(&reader, _X("http://www.3w.org/2000/xmlns"), _X("typeface")) {//type
_majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);
And I get the same result: nothing.
Any Suggestion.
Thanks in advance.
I answer myself.
After ckeck libopc source code the solution is set namespace value in mce_start_attribute macro as NULL:
mce_start_attribute(&reader, NULL, _X("typeface")) {//type
_majorFont = (char*) xmlTextReaderConstValue(reader.reader);
}mce_end_attribute(&reader);
Related
I want to get the email body from my Gmail account for an email so i use this code i found it in an example for how to read emails using c++ builder pop3
the code to extract body used
TIdText *EText;
int message = SpinEdit1->Value;
MyPoP3->Retrieve(message, MyEmail);
Edit1->Text = MyEmail->Subject + " | " + MyEmail->From->Address;
Memo1->Clear();
for (int i = 0; i < MyEmail->MessageParts->Count; i++) {
Memo1->Lines->Add(MyEmail->MessageParts->Items[i]->ContentType);
EText = dynamic_cast<TIdText*>(MyEmail->MessageParts->Items[i]);
Memo1->Lines->Add(EText->Body);
}
the problem is that i got undefine symbol to TidText and what i tried is to change it from TIdText to TIdMessage, but i got that i can't convert to it.
also i tried to try this without loop or something MyEmail->Body->Text
this return empty string.
the video i got this code from it here i don't know maybe the c++ builder he use is old. now i want to know how to extract the body text from the email address.
Thanks in advance.
the problem is that i got undefine symbol to TidText
Your code is missing an #include <IdText.hpp> statement.
what i tried is to change it from TIdText to TIdMessage, but i got that i can't convert to it.
Because TIdMessage does not contain nested TIdMessage objects.
also i tried to try this without loop or something MyEmail->Body->Text this return empty string.
If your email is MIME encoded, its text is not stored in the TIdMessage::Body property, but in a nested TIdText object within the TIdMessage::MessageParts collection. You have to look at the TIdMessage::ContentType property to know what kind of structure the email contains. For instance, if the CT begins with text/, the text is in the TIdMessage::Body. But if the CT begins with multipart/, the text is somewhere in the TIdMessage::MessageParts instead.
You should read this blog article on Indy's website for an example of how emails might be structured:
HTML Messages
the video i got this code from it here i don't know maybe the c++ builder he use is old.
No, it is not.
Hello :) I would like to import the data I marked as red.
after connecting my program to DB,
I executed this line
m_strE37 = m_command.GetString(37);
but unfortunately, m_strE37 stores "1.6799999999999"
their class is as follows
CString m_strE37;
typedef CCommand<CDynamicsStringAccessorW,CRowset> DbCommand;
DbCommand m_command;'
I Selected that record(row) and tried to get the value by using GetString(37) since it is 37th column.
I was quite new to this DB Process.
Can anyone help me to correctly get 1.68 ??
Thank you a lot in advance!
Try this snippet:
float f = atof(m_strE37);
m_strE37.Format("%3.2f",f);
For unicode :
float f = atof(CStringA(m_strE370.GetString()));
m_strE37.Format(L"%3.2f",f);
I am new to Python and am trying to get my ahead around parsing SSE client code. I am using the SSE Client library. My code is very basic and follows the sample exactly. Here it is:
from sseclient import SSEClient
devID = "xxx"
AToken = "xxx"
sparkURL = 'https://api.spark.io/v1/devices/' + devID + '/events/?access_token=' + AToken
messages = SSEClient(sparkURL)
for msg in messages:
print(msg)
print(type(msg))
The code runs without a problem and I see some blank lines and SSE data coming through. Here is the sample output:
<class 'sseclient.Event'>
{"data":"0 days, 0:54:43","ttl":"60","published_at":"2015-04-09T22:43:52.084Z","coreid":"xxxx"}
<class 'sseclient.Event'>
<class 'sseclient.Event'>
{"data":"0 days, 0:55:3","ttl":"60","published_at":"2015-04-09T22:44:12.092Z","coreid":"xxx"}
<class 'sseclient.Event'>
The actual output above looks like a dictionary, but its type is "sseclient.Event". I am trying to figure out how to parse the output so I can pull out one of the fields and nothing I have tried has worked.
Sorry if this is basic questions, but can someone provide some simple guidance on how I would either convert the entire output to a dictionary or perhaps just pull out one of the fields?
Thank you in advance!
I figured this out. In case anyone else experiences the same problem, here is how I got it to work. The key was using msg.data and not just msg. I then converted the out using the JSON library and am good to go.
messages = SSEClient(sparkURL)
for msg in messages:
outputMsg = msg.data
if type(outputMsg) is not str:
outputJS = json.loads(outputMsg)
FilterName = "data"
#print( FilterName, outputJS[FilterName] )
print(outputJS[FilterName])
I see this sample:
http://www.aspose.com/docs/display/slidesnet/Creating+a+Table+from+Scratch
...and when I try to use it, I see that the library has changed (I guess) and it needs me to do sth like that:
int lIndex = pSld.Shapes.AddTable(pUppLeftPoint.X, pUppLeftPoint.Y, pColumnWidths, pRowWidths);
TableEx lTable = (TableEx)pSld.Shapes[lIndex];
(I can only cast to TableEx and not to Table)
But I cannot find how to get the cell's TextFrame. The site says :
TextFrame tf = table.GetCell(0, 0).TextFrame;
But I have nothing like this...
Am I missing sth?
Any ideas?
EDIT :
I found out that my code is for PPTX and the site's code for PPT:
http://www.aspose.com/community/forums/thread/453613/facing-performance-issue-due-to-addtable-method-of-pptx.aspx
But, again, how do you get the cell's contents in PPTX?
Ha! I got it!
There's an indexer:
lTable[i,j]
i have currently generated some XML using xercer in C++, using the following code:
XMLCh tempAttribute[100];
XMLString::transcode("ad", tempStr, 99);
doc = impl->createDocument(0,tempStr ,0);
root = doc->getDocumentElement();
XMLString::transcode("imageAd", tempStr, 99);
element = doc->createElement(tempStr);
root->appendChild(element);
However i am attempting to get the attributes within the top "ad" element (as below), however i have had little luck in doing so, can someone with experience using xerces please advise.
Thanks in advance!
<ad xsi:noNamespaceSchemaLocation="smaato_ad_v0.9.xsd" modelVersion="0.9">
<imageAd>
maybe you didn't saw the call to setAttribute in my previous answer but you can set any attribute for any element with calls like
root->setAttribute(L"modelVersion", L"0.9");
root->setAttribute(L"xsi:noNamespaceSchemaLocation", L"xsi:noNamespaceSchemaLocation");
Where root is the pointer to your root element.