|
Sorry, not sure I understand.
|
|
|
|
|
Imagine the following case:
V1 V2 V3
longv1 longv2 longv3
It seems that OP's values (in a single column) have disparate widths.
The same kind of "issue" which leads to code-blocks like
int value = 0;
char* name = "dummy";
vector<char> characters = ;
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
|
Since the process involves the use of the clipboard, there are a couple of solutions which come to my mind:
- You could create a VBA macro in Excel which would format the contents:
- You would need some PADLEFT or PADRIGHT kind of function:
Function PadLeft(text As Variant, totalLength As Integer, padCharacter As String) As String
PadLeft = String(totalLength - Len(CStr(text)), padCharacter) & CStr(text)
End Function
Function PadRight(text As Variant, totalLength As Integer, padCharacter As String) As String
PadRight = CStr(text) & String(totalLength - Len(CStr(text)), padCharacter)
End Function (source: SO: Any method equivalent to PadLeft/PadRight?[^]
- Then use one of these functions to pad the values to the width of the largest value and place the result in the clipboard.
- Have a button in Excel which launches the macro (whose result will be formatted text exported to the clipboard).
- Or find an utility which can automatically format the content of the clipboard according to a specified format string. Honestly, I have never searched for such a tool, I don't even know if that exists.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
It is impossible only excel knows how wide the original columns were, that is why it puts the delimiters in the text to mark the columns
So if you want the original column width in excel you need to get excel to put them in a cell so it gets exported with the data and you can then use it to reformat the layout.
I know for say cell A1 width the excel formula is =CELL("width", A1) which displays as a decimal number.
What exactly that number is I have no idea but you can try searching for it or just play with a few letters and font heights and you should be able to work it out.
In vino veritas
|
|
|
|
|
I don't mean the width in pixels or whatever unit Excel is using, I mean width in number of characters.
|
|
|
|
|
I know but you aren't really looking at problem. The fonts in the cells are true type proportional not old school fixed pixel fonts so unless you have display formats on them you are dead out luck they wont be fixed character widths.
So the best you can probably do is the pixel width and then divid it by some number so if the font sort of averages 10 pixels width the 100 pixel column = 100/10 = 10 characters and 150 pixel width column gives you 15 characters.
You aren't going to be able to do much better than that at at least it will be somewhat columnized
In vino veritas
|
|
|
|
|
I found a perfect tool, please see my reply below.
|
|
|
|
|
|
In struggling to convert a piece of Linux code to Windows, I cannot rid of this errors:
typedef enum {
NULL_RID = 0, WORLD_RID = 0,
LOCAL_RID = 0,
OWNER_RID = 0,
GROUP_RID = 1,
....
....
PREACCESS = 0x22a,
} SOME_IDE;
seem to be something simple, but what ? Can you give me a little help ?
|
|
|
|
|
It looks to be syntactically correct. Maybe how it's used is incorrect, or some piece of code preceding it is incorrect.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Probably there is a #define like, for instance
#define NULL_RID 0
In the included files (use Visual Studio 'search in files' editor command to find it).
See example 2 in the following page Compiler Error C2059 | Microsoft Docs[^].
|
|
|
|
|
There is most likely something missing or incorrect, earlier in the code that you have not shown.
|
|
|
|
|
I just started to study this theme, so strongly do not swear.
Tell me why this code works.
HBITMAP startBitmap = (HBITMAP)LoadImage(NULL, "D:\\159.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
m_PictureControl.SetBitmap(startBitmap);
And this does not work.
HANDLE FileR = CreateFile("D:\\159.bmp", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD size_file = GetFileSize(FileR, 0);
HBITMAP startBitmap = (HBITMAP)malloc(size_file);
DWORD dwReadW;
ReadFile(FileR, startBitmap, size_file, &dwReadW, NULL);
m_PictureControl.SetBitmap(startBitmap);
As I assume the buffer is necessary as it is to prepare before an image displayed on the screen. But unfortunately I do not understand how to do it.
modified 2-Oct-19 14:04pm.
|
|
|
|
|
The first reads an existing file; the second creates an "empty" file and expects magic.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Gerry Schmitz wrote: an "empty" file
If you not it is difficult explain please my mistake.
I'm not creating a file I'm reading it to the buffer. The data from the buffer in order.
modified 2-Oct-19 14:03pm.
|
|
|
|
|
Member 12661464 wrote:
And this does not work. Which means what exactly?
Have you stepped through the code to make sure that CreateFile() , GetFileSize() , ReadFile() , and SetBitmap() all return "success" values?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
The first reads file and "convert" the read data to be interpreted as a HBITMAP.
The second just reads some binary data that cannot be interpreted as a HBITMAP.
|
|
|
|
|
Victor Nijegorodov wrote: cannot be interpreted as a HBITMAP
I understand this, but I can't understand how do I convert this data to an image, how do I process the buffer?
|
|
|
|
|
Well, what is your goal? Are you trying to reinvent the wheel? Or what?
|
|
|
|
|
I want to understand what the LoadImage function does with a file, cuts off the header ? How does it convert data?
I find the image in the resources of the file, it does not lie in the open as a picture. I read in buffer specifically the place where image of the is.
modified 2-Oct-19 17:10pm.
|
|
|
|
|
|
The data you have read from the file is in raw format and needs to be converted to Bitmap format. Your code is missing the conversion part. See bitmap format - Google Search[^].
|
|
|
|
|
I would be very grateful for a hint which WinAPI functions convert data to Bitmap format.
|
|
|
|
|