如何获得文本块的高度? [英] How can I get height of text block?

查看:66
本文介绍了如何获得文本块的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户,我在几年前写了一个MS Access应用程序

他们需要知道一块文本的高度以英寸为单位

他们的客户。 MS Access应用程序在后台打开Word,进行一些

设置(字体,字体大小,边距等)并获得高度。这就是所有

在3年或4年内运作良好。


然而,整个事情将重新用于浏览器中<带有vb.net的
asp.net。我们希望消除为此使用Word的需要。为了这个,我想在vb.net中编写一个函数
。整个过程将在Windows和Mac机器上运行。我在这里找到了一些信息:

http://www.experts-exchange.com/Prog....NET/Q_2182000

8.html


但我不确定这是正确的做法。我希望有人

可以指出我正确的方向。


谢谢,


Keith

解决方案

" Keith G Hicks" < kr*@comcast.netschrieb


我有一个客户端,我写了几年的MS Access应用程序

前他们需要知道一块文本的高度(以英寸为单位)

来为他们的客户收费。 MS Access应用程序在

背景中打开Word,进行一些设置(字体,字体大小,边距等)和

获得高度。 3年或4年都能很好地工作。


然而,整个事情将重新用于浏览器

in asp .net与vb.net。我们想要消除使用Word

的需要。我想在vb.net中为此编写一个函数。整个

的东西将在Windows和Mac机器上运行。我在这里找到了一些信息:

http://www.experts-exchange.com/Prog....NET/Q_2182000

8.html



需要登录。无论如何,设备上的文件大小

机器使用哪个dpi设置和你想要哪个字体
计算?我不能给ASP.Net特定的答案,但是我想b
认为必须首先询问问题。


但是我不确定这是正确的做法。我希望有人能够把我指向正确的方向。



Armin


如果您向下滚动到该网址页面的底部,你会看到

答案。只有专家才需要登录答案。还有其他

答案,任何人都可以在所有广告下面看到。我不是订户

我也经常从那里得到答案。


另外,我应该提到字体和其他设置是具体

来获取长度。它不依赖于文本的内容。在我们现在使用的

字代码中,我将字体设置为Arial 7,单个间隔,0 / $
段落前后的间距,文本宽度设置为1.5英寸

设置页面大小和边距。然后我可以得到文本的确切高度

以英寸为单位。这是我在vb.net中需要做的事情,但没有Word。

高度将基于相同的设置字体,文字宽度和段落

设置。在这方面,它与用户

对我所包含的URL的问题有点不同。


基思


" Armin Zingler" < az ******* @ freenet.dewrote in message

news:uA ************** @ TK2MSFTNGP06.phx.gbl ...


" Keith G Hicks" < kr*@comcast.netschrieb


我有一个客户端,我写了几年的MS Access应用程序

前他们需要知道一块文本的高度(以英寸为单位)

来为他们的客户收费。 MS Access应用程序在

背景中打开Word,进行一些设置(字体,字体大小,边距等)和

获得高度。 3年或4年都能很好地工作。


然而,整个事情将重新用于浏览器

in asp .net与vb.net。我们想要消除使用Word

的需要。我想在vb.net中为此编写一个函数。整个

的东西将在Windows和Mac机器上运行。我在这里找到了一些信息:

http://www.experts-exchange.com/Prog....NET/Q_2182000

< blockquote class =post_quotes>
8.html



需要登录。无论如何,设备上的文件大小

机器使用哪个dpi设置和你想要哪个字体
计算?我不能给ASP.Net特定的答案,但是我想b
认为必须首先询问问题。


但是我不确定这是正确的做法。我希望有人能够把我指向正确的方向。




Armin





为什么不解决真正的问题...为什么他们需要一个文本的'hieght''块
块?我认为它是用于报告而不是''你的文字hiegh是2.4英寸''

....你是否动态更改报告,边距,位置...基于

这个hieght?首先回答这个问题,然后进行相应的设计。


否则,我不确定你会如何/可以去做这个...建立一个

标签集自动调整尺寸...用文字填充...调整宽度...得到

高度?


杰夫。

Keith G Hicks < kr*@comcast.netwrote in message

news:%2 **************** @ TK2MSFTNGP02.phx.gbl ...


如果向下滚动到该URL中页面的底端,您将看到

答案。只有专家才需要登录答案。还有

其他

答案,任何人都可以在下面看到所有的广告。我不是一个

订阅者

我也经常从那里得到答案。


此外,我应该有提到字体和其他设置是

具体

来获取长度。它不依赖于文本的内容。在我们现在使用的

字代码中,我将字体设置为Arial 7,单个间隔,0 / $
段落前后的间距,文本宽度设置为1.5英寸

设置页面大小和边距。然后我可以得到文本的确切高度

以英寸为单位。这是我在vb.net中需要做的非常多的事情,但没有

Word。

高度将基于相同的设置字体,文本宽度和段落

设置。在这方面,它与用户

对我所包含的URL的问题有点不同。


基思


" Armin Zingler" < az ******* @ freenet.dewrote in message

news:uA ************** @ TK2MSFTNGP06.phx.gbl ...


>" Keith G Hicks" < kr*@comcast.netschrieb


我有一个客户端,我写了几年的MS Access应用程序

前他们需要知道一块文本的高度(以英寸为单位)

来为他们的客户收费。 MS Access应用程序在

背景中打开Word,进行一些设置(字体,字体大小,边距等)和

获得高度。 3年或4年都能很好地工作。


然而,整个事情将重新用于浏览器

in asp .net与vb.net。我们想要消除使用Word

的需要。我想在vb.net中为此编写一个函数。整个

的东西将在Windows和Mac机器上运行。我在这里找到了一些信息:

http://www.experts-exchange.com/Prog....NET/Q_2182000


8.html


需要登录。无论如何,设备上哪个设备使用哪个dpi设置以及你想要计算哪种字体的文本大小?我不能给ASP.Net特定的答案,但我认为必须首先询问问题。


但我是不确定这是正确的方法。我希望有人能够把我指向正确的方向。



Armin




I have a client that I wrote an MS Access app for quite a few years ago
where they need to know the height in inches of a block of text for billing
their customers. The MS Access app opens Word in the background, makes some
settings (font, font size, margins, etc.) and gets the height. It''s all
worked quite well for 3 or 4 years.

However, the whole thing is going to be redone for use in browsers in
asp.net with vb.net. We want to eliminate the need to use Word for this. I''d
like to write a function in vb.net for this. The whole thing is going to be
run on both Windows and Mac machines. I found some info here:

http://www.experts-exchange.com/Prog....NET/Q_2182000
8.html

but I''m not sure it''s the correct approach. I was hoping someone
could point me in the right direction.

Thanks,

Keith

解决方案

"Keith G Hicks" <kr*@comcast.netschrieb

I have a client that I wrote an MS Access app for quite a few years
ago where they need to know the height in inches of a block of text
for billing their customers. The MS Access app opens Word in the
background, makes some settings (font, font size, margins, etc.) and
gets the height. It''s all worked quite well for 3 or 4 years.

However, the whole thing is going to be redone for use in browsers
in asp.net with vb.net. We want to eliminate the need to use Word
for this. I''d like to write a function in vb.net for this. The whole
thing is going to be run on both Windows and Mac machines. I found
some info here:

http://www.experts-exchange.com/Prog....NET/Q_2182000
8.html

Login required. Anyway, the size of the text on which device on which
machine using which dpi settings and which font do you want to
calculate? I won''t be able to give an ASP.Net specific answer but I
think the questions must be asked first.

but I''m not sure it''s the correct approach. I was hoping someone
could point me in the right direction.


Armin


If you scroll down to the bottom end of the page in that URL, you''ll see
answers. Login is only required for the "expert''s" answers. There are other
answers that anyone can see below all the advertising. I''m not a subscriber
either and I get answers from there quite often.

Also, I should have mentioned that the font and other settings are specific
to get the length. It''s not dependent on what the text comes in as. In the
Word code we''re using now, I set the font to Arial 7, single spaced, 0
spacing before and after paragraphs, text width is set to 1.5 inches by
setting page size and margins. Then I can get the exact height of the text
in inches. That''s pretty much wath I need to do in vb.net but without Word.
Height will be based on the same settings font, text width and paragraph
settings. In this respect it''s a bit different than the question the user
had on the URL I included.

Keith

"Armin Zingler" <az*******@freenet.dewrote in message
news:uA**************@TK2MSFTNGP06.phx.gbl...

"Keith G Hicks" <kr*@comcast.netschrieb

I have a client that I wrote an MS Access app for quite a few years
ago where they need to know the height in inches of a block of text
for billing their customers. The MS Access app opens Word in the
background, makes some settings (font, font size, margins, etc.) and
gets the height. It''s all worked quite well for 3 or 4 years.

However, the whole thing is going to be redone for use in browsers
in asp.net with vb.net. We want to eliminate the need to use Word
for this. I''d like to write a function in vb.net for this. The whole
thing is going to be run on both Windows and Mac machines. I found
some info here:

http://www.experts-exchange.com/Prog....NET/Q_2182000

8.html


Login required. Anyway, the size of the text on which device on which
machine using which dpi settings and which font do you want to
calculate? I won''t be able to give an ASP.Net specific answer but I
think the questions must be asked first.

but I''m not sure it''s the correct approach. I was hoping someone
could point me in the right direction.



Armin




why not solve the real problem ... why do they need the ''hieght'' of a text
block? I assume it is for reporting and not ''Your text hiegh is 2.4 inches''
.... are you dynamically changing a report, margins, locations ... based on
this hieght? Answer that question first, and design accordingly.

Otherwise, I am not sure how you would/could go about this ... build an
label set to auto size ... fill it with text ... adjust the width ... get
the hight?

Jeff.
"Keith G Hicks" <kr*@comcast.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

If you scroll down to the bottom end of the page in that URL, you''ll see
answers. Login is only required for the "expert''s" answers. There are
other
answers that anyone can see below all the advertising. I''m not a
subscriber
either and I get answers from there quite often.

Also, I should have mentioned that the font and other settings are
specific
to get the length. It''s not dependent on what the text comes in as. In the
Word code we''re using now, I set the font to Arial 7, single spaced, 0
spacing before and after paragraphs, text width is set to 1.5 inches by
setting page size and margins. Then I can get the exact height of the text
in inches. That''s pretty much wath I need to do in vb.net but without
Word.
Height will be based on the same settings font, text width and paragraph
settings. In this respect it''s a bit different than the question the user
had on the URL I included.

Keith

"Armin Zingler" <az*******@freenet.dewrote in message
news:uA**************@TK2MSFTNGP06.phx.gbl...

>"Keith G Hicks" <kr*@comcast.netschrieb

I have a client that I wrote an MS Access app for quite a few years
ago where they need to know the height in inches of a block of text
for billing their customers. The MS Access app opens Word in the
background, makes some settings (font, font size, margins, etc.) and
gets the height. It''s all worked quite well for 3 or 4 years.

However, the whole thing is going to be redone for use in browsers
in asp.net with vb.net. We want to eliminate the need to use Word
for this. I''d like to write a function in vb.net for this. The whole
thing is going to be run on both Windows and Mac machines. I found
some info here:

http://www.experts-exchange.com/Prog....NET/Q_2182000

8.html


Login required. Anyway, the size of the text on which device on which
machine using which dpi settings and which font do you want to
calculate? I won''t be able to give an ASP.Net specific answer but I
think the questions must be asked first.

but I''m not sure it''s the correct approach. I was hoping someone
could point me in the right direction.



Armin




这篇关于如何获得文本块的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆